locked
How do i fire events after save? (CRM 2013) RRS feed

  • Question

  • the onload event used to fire after a save. How do I fire an event only after a user saves the record?

    Thanks in advance,
    Jonathan

    Thursday, January 2, 2014 10:16 PM

All replies

  • Hi,

    You couldn't use OnSave event?

    Ronald

    OnSave Event

    The OnSave event occurs when:

    • The user clicks the Auto save iconbutton in the lower right corner of the form, even when there is no changed data to be saved.
    • Code executes the Xrm.Page.data.entity.save method, even when there is no changed data to be saved.
    • The user navigates away from the form and there is unsaved data in the form.
    • With auto-save is enabled, 30 seconds after data has changed and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.save method and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.refresh method passing a true value as the first parameter and there is unsaved data in the form.

    To determine which button was clicked to perform the save, use the getSaveMode method.

    You can cancel the save action by using the preventDefault method within the event arguments object. The preventDefault method which is accessible by using the getEventArgs method that is part of the execution context. You must configure the form event handler to pass the execution context. For more information, see Use execution context and the form event pipeline.


    Ronald

    Thursday, January 2, 2014 10:37 PM
  • The on save doesnt work. It fires before save. I want to fire an event after save.
    Friday, January 10, 2014 11:20 PM
  • Hi,

    I will suggest you to implement your logic in server side code, so you can write post create/post update plugin.

    HTH


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by Ronald Liu Sunday, January 12, 2014 6:42 PM
    Sunday, January 12, 2014 5:56 PM
    Moderator
  • use

    Xrm.Page.data.save().then(successCallback, errorCallback)

    • Proposed as answer by Edwin Abdalian Monday, January 27, 2014 7:45 PM
    Monday, January 27, 2014 7:45 PM