I am trying to disable a date field(by selecting date) in the Dynamics365 CRM UCI version. It is disabling it but on selecting the date twice. It is working fine in a classical mode but not on UCI
here is my code.
function ConfirmFunction(){
debugger;
var get_aob_date = Xrm.Page.ui.controls.get("ies_aobdatercvd");
var confirmStrings = { text:"This is a confirmation.", title:"Confirmation Dialog" };
var confirmOptions = { height: 200, width: 450 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed)
get_aob_date.setDisabled(true);
else
Xrm.Page.getAttribute("ies_aobdatercvd").setValue();
});
}
Is this in a custom web resource?
The use of Xrm.Page is deprecated for everything other than custom web resources(currently) and should be replaced with the execution context.
https://learn.microsoft.com/en-us/power-platform/important-changes-coming#some-client-apis-are-deprecated
Here is what your code should look like to disable your field:
When you add the event to the onLoad (or any other event) you'll need to check the "Pass execution context" checkbox: