Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

D365 Script executing twice when Onsave

Posted on by Microsoft Employee

So I have a script in one of my forms that calls a web service on the onSave event and creates a register on my database. My current problem is that I don't know how but the script is called 2 times when someone saves the form so every time I get duplicates in my database, is there anyway to set the form to only call once onSave? 

This also is happening with other scripts so I am sure that it is not a script problem, I am thinking that maybe the form triggers save and auto save at the same time so thats why my web service is being called 2 times 

  • Charles Abi Khirs Profile Picture
    Charles Abi Khirs 3,569 on at
    RE: D365 Script executing twice when Onsave

    Is there any plugins/workflows that are triggered and also updating the record?

    You can also enable the audit history on this entity and check if there are 2 update actions that are being done when you save.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: D365 Script executing twice when Onsave

    Yes there is no save function in my scripts, the only trigger is the onSave command in the form

  • Charles Abi Khirs Profile Picture
    Charles Abi Khirs 3,569 on at
    RE: D365 Script executing twice when Onsave

    Hello,

    Did you check if there is the save function in your script that triggers again the save action, or a plugin that executes on the save and does an update as well?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans