Hi,
I'm using the MobileCRM.UI.EntityForm.onChange function within the Bookable Resource Booking (Booking entity) in Woodford app for Dynamics CRM 365.
My objective is to change the booking status with JavaScript and save the booking immediately. But the two last lines of code in the If{...} aren't working (red lines). Any ideas? Thanks in advance!
MobileCRM.UI.EntityForm.onChange(
function (entityForm) {
var changedItem = entityForm.context.changedItem;
if (changedItem == "nds_endjob") {
// Now get edited entity Bookable Resource Booking and set its booking status field to "Complete"
var editedEntity = entityForm.entity;
//The following two lines are just to make sure that I can get the Booking status Id.
var bookid = entityForm.entity.properties.bookingstatus.id;
alert(bookid);
// These are the lines that are not working: Setting the value to Completed and then Saving the Bookable Resource Booking right away.
editedEntity.properties.bookingstatus.Value = "Completed";
editedEntity.save;
}
},
true,
null
);