Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

getSaveMode() always returns 1 on email

Posted on by 1,771

Hi!

I've added a function to the onsave event in MSCRM which is supposed to check the save method and do some stuff if the email is sent.

According to Microsoft's documentation it should be possible to get this from the execution context on save (value = 7):

https://msdn.microsoft.com/en-us/library/gg509060.aspx

I've written the following javascript function which I've added both to the onsave-method in the form properties as well as using the addOnSave() method:

doStuffOnSend = function(context) {
    var args = context.getEventArgs();
    console.log(args.getSaveMode()); // Always prints 1
    if (args.getSaveMode() === 7) {
        console.log("This never executes");
    }
}


I've tried on CRM2016 RTM as well as Dynamics365 (on-premises)

*This post is locked for comments

  • Marius Agur Pedersen Profile Picture
    Marius Agur Pedersen 1,771 on at
    RE: getSaveMode() always returns 1 on email

    I've added it as an idea, seeing how microsoft connect no longer accepts issues on MSDYN:

    crmideas.dynamics.com/.../ID0000842

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: getSaveMode() always returns 1 on email

    Hi,

    I have exactly the same issue, looks like a bug in API, maybe it's worth raising a support ticket to Microsoft for a fix.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans