Hello CS Experts,
I have a custom button on the form and I want to make it visible only when a date field has a value.
Initially, the date field is set to blank. After sometime, the record will be updated and a value for the date field will be supplied.
I am using a javascript to set the value for the date field and on the OnChange event I also want to save the value entered.
However, I am getting an error like: getAttribute is not a function.
Below is my javascript code:
function setDeletionDate(executionContext){
var formContext=executionContext.getFormContext();
var delDate = new Date();
formContext.getAttribute("ava_gdprdeletiondate").setValue(delDate);
formContext.data.entity.save().then(
function () {
// Success callback, you can do other logic here if needed.
},
function (error) {
// Error callback
Xrm.Utility.alertDialog(error);
}
)
}
I am not sure if I'm getting the js code correctly or not. Please help!
Regards,
Jolas365