
Announcements
Hello Everyone !!
I have one requirement that if Lead is getting qualify, need to open it's parent contact form.
For this I am using addOnPostSave event. I have bind this event on load of the form but it is not been called when I am qualifying lead. It is beeing called when I SAVE the lead by pressing OOB save button.
Can someone please confirm if we can use this event after lead qualify OR we can ONLY use it after we are saving the form OOB save button.
Thanks in advance !!
Hi Inkey Solutions,
I tested this function. Yes, it is triggered when the record is saved as the doc(docs.microsoft.com/.../addonpostsave) says:
"Adds an event handler to be called after the record is saved with success or failure.".
However, it's not only triggered when you click OOB save button. It's also triggered when you use formContext.data.save(). Please see the below code:
function onLoad(executionContext)
{
var formContext = executionContext.getFormContext();
formContext.data.entity.addOnPostSave(myFunction);
setTimeout(()=>{
formContext.getAttribute("jobtitle").setValue(formContext.getAttribute("jobtitle").getValue() + "a");
formContext.data.save();}
,3000)
}
function myFunction(){
alert("1");
}
Result:
If you enabled auto saved feature, I believe that it could also be triggered when the record is auto saved(I didn't test this).
So this function can't achieve your requirement. You can try customize Qualify button command with Ribbon Workbench. It should work.