Unable to set date field
Xrm.WebApi.retrieveRecord(cmLogicalName, cmGuid, "?$select=lvt_completiondate").then(
function success(result) {
debugger;
var duedatebasedonCM = result["lvt_completiondate@OData.Community.Display.V1.FormattedValue"]; //"28/02/2019"
Xrm.Page.getAttribute("lvt_duedate").setValue(duedatebasedonCM); //no error // Value is not set
},
function (error) {
}
);
*This post is locked for comments
Converted the date as below and it worked.
duedatebasedonCM=new Date(duedatebasedonCM);
Please validate your date format. Is there same format for both date field?
Hi,
You need to convert Date object before set the value .Try with this -
Xrm.Page.getAttribute("lvt_duedate").setValue(new Date(result["lvt_completiondate@OData.Community.Display.V1.FormattedValue"]));
Check here for more info-
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156