Hi,
I have two custom fields in the task entity, Text and Duration.
When a user fills both fields, I need to save the form (if its in create mode) , create a external record and then clear the fields.
if we open an pre-existing task. it works fine. but if I create a new task, once the user hits save button. the "duration" comes back to the original number... ??
I'm sure my JavaScript talents are the culprit... I have no idea what I am doing wrong. (the text field works fine)
function Tasks_addduration() { if ((Xrm.Page.getAttribute('new_addtotaskdescription').getValue() != null) && (Xrm.Page.getAttribute('new_addtoduration').getValue() != null)) { if (Xrm.Page.ui.getFormType()==1){ Xrm.Page.data.save().then(Tasks_createtasklog , function(){alert("La creation du Task Log a échoué voir tony");}); } else { alert("no longer in create mode") ; Xrm.Page.getAttribute('new_addtoduration').setValue(null); Xrm.Page.getAttribute('new_addtotaskdescription').setValue(null); Xrm.Page.data.entity.save(); } } function Tasks_createtasklog() { alert("duration! Before Null:" Xrm.Page.getAttribute('new_addtoduration').getValue().toString()) ; Xrm.Page.getAttribute('new_addtoduration').setValue(null); Xrm.Page.getAttribute('new_addtotaskdescription').setValue(null); alert("after nulled") } }