RE: Use addOnPostSave event after qualifying Lead
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.