Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

getSaveMode on Mark complete of activity CRM 365 (v9.0)

Posted on by 2,541

Hello,

I've a requirement to display a popup before the activity is saved and complete to ask the user if he is sure.
So i started to implement my function on my OnSave event.
I read here : https://msdn.microsoft.com/en-us/library/gg509060.aspx#BKMK_GetSaveMode that the SaveMode 58 is dedicated to the activity so i know that the user clicked on the button.
On CRM 2016 (v8.1), this works like a charm.
On Dynamics 365 (V9), the getSaveMode always return 1.
Anyone knows if it's a bug or the way to know that the save come from this button in the ribbon is different ?

Thanks a lot,

Clément 

*This post is locked for comments

  • Hemanth Z Profile Picture
    Hemanth Z 25 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Hi,

    Clement

    I'm trying to achieve something similar , I'm trying to create a custom button like Mark complete when users click the custom button it needs to pop-up  with are you sure you want to close the call?? ok and cancel button

    I didn't find any javascript code to achieve this, did you find an answer to your mark complete button.

    Thanks for the suggestion.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Hi Clement,

    There are still many known and unknown bugs in V9, so it is very possible that this is one of them.

    If you do not reach a resolution I would suggest logging this on ideas.dynamics.com, a post a link here so that people can vote up on it if experiencing the same thing.

    Good luck.

  • Suggested answer
    jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Did you get this working?  I think there is an issue in version 9 of CRM.  My IFrame JavaScript that I have run on the OnReadyStateComplete event of an IFrame doesn't run.  I ended up having to hard code the url rather then pull it from the getSrc() method and append the id to the end of it.  Not the way I wanted to do it, but the only way I could get it to run consistantly.  I then placed it on the OnLoad function.  I know this is different from your issue, but I think it is odd that we both have issues with JavaScript in v9 not running as expected.  So I am going to say there is a bug in v9.

  • Clem Profile Picture
    Clem 2,541 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    docs.microsoft.com/.../addonsave

    This way, i can attached as many functions i want to the OnSave event without going to the form properties. As says the page above, the executioncontext is automatically passed to the function via the variable "event" for me.

    I don't want to override the default behavior of the Mark complete button from the ribbon so i want to avoid using a custom call of the "[...]data.entity.save()[...]"

    Exact same configuration works on 8.1/8.2.

  • Suggested answer
    jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    I think it might be the "addOnSave"

    docs.microsoft.com/.../save

  • Suggested answer
    jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    [quote][/quote]

    Line 12 you are getting the form context instead of the Event Args. try changing that to context.getEventArgs(); and see if you have any different results.  Also I have seen with v9 there being caching, so you may need to clear your cache or try a different browser when troubleshooting JS and making changes.  It appears the way forms are rendered has changed greatly in v9.  I just went through this headache with IFrame's and using JavaScript for dynamically creating the URL.

    Disreagrad.  I see the EventArgs on line 19.

  • jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Disreagrad.  I see the EventArgs on line 19.

  • Suggested answer
    jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Line 12 you are getting the form context instead of the Event Args. try changing that to context.getEventArgs(); and see if you have any different results.  Also I have seen with v9 there being caching, so you may need to clear your cache or try a different browser when troubleshooting JS and making changes.  It appears the way forms are rendered has changed greatly in v9.  I just went through this headache with IFrame's and using JavaScript for dynamically creating the URL.

  • Clem Profile Picture
    Clem 2,541 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    I mentionned the mode 58 which is linked to the save & complete of the activities.

    Here is my code (simple) : 

    2018_2D00_01_2D00_02_5F00_17_2D00_45_2D00_48_5F00_chrome.png

    the debug is triggered when i click on the button : "Mark complete" from the ribbon.

    Clément

  • Suggested answer
    jestuder Profile Picture
    jestuder 156 on at
    RE: getSaveMode on Mark complete of activity CRM 365 (v9.0)

    Check the example at the bottom of that link.  There are syntax changes that where made.  Also you mentioned 70 which is assigned too Auto Save.  If the user is saving it, this isn't an "Auto Save" but a save(1).  That is why you are seeing 1 returned.  Can you provide the code?

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans