Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Use addOnPostSave event after qualifying Lead

(0) ShareShare
ReportReport
Posted on by 1,868

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 !!

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    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:

    pastedimage1639100973032v1.png

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans