locked
CRM 2011: How to call a Save method in javascript. RRS feed

  • Question

  • Hi All,

        In CRM 4.0 we usally use crmForm.Save(); method to invoke the save method in our javascript code. How about in CRM 2011 ?. How to invoke save method in CRM 2011?

     

     

    any idea ?

     

    Regards,

    Safi.


    SAFI
    Friday, December 9, 2011 7:45 AM

Answers

  • you can use the following command.

    Xrm.Page.data.entity.save();
    



    Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Friday, December 9, 2011 8:24 AM
  • Just to add to what Thomas has already said, you can also perform a 'Save and New' and 'Save and Close' by passing in string parameters, i.e. Xrm.Page.data.entity.save('saveandnew'); and Xrm.Page.data.entity.save('saveandclose');

    Friday, December 9, 2011 9:30 AM

All replies

  • you can use the following command.

    Xrm.Page.data.entity.save();
    



    Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Friday, December 9, 2011 8:24 AM
  • Just to add to what Thomas has already said, you can also perform a 'Save and New' and 'Save and Close' by passing in string parameters, i.e. Xrm.Page.data.entity.save('saveandnew'); and Xrm.Page.data.entity.save('saveandclose');

    Friday, December 9, 2011 9:30 AM
  • I tried to put the Xrm.Page.data.entity.save() into an onSave event - I want to Save, and then perform an action on the item - but it looks like the save() is not valid in the onSave event. (Object does not support Property or Method) Does that sound correct?

    Any ideas how I an do this? (I thought of creating a custom button to do the save and then execute the action after that)

    Cheers

    Wednesday, June 20, 2012 1:33 PM
  • You can trigger the Xrm.Page.data.entity.save() from custom ribbon button.  This will automatically trigger the Form save event. Then you can write your custom logic on the Save event.

    Could you explain what you trying to achive on the On Save event?


    SAFI

    Friday, June 22, 2012 6:44 AM
  • Hi,

    You can use the below commands,

    For Save:
    Xrm.Page.data.entity.save();

    For Save and New:
    Xrm.Page.data.entity.save('saveandnew'); 

    For Save and Close:
    Xrm.Page.data.entity.save('saveandclose');

    Make sure to "Mark As Answer" and "Vote as Helpful", if you get answer of your question.

    Regards,
    Priyank Jain

    Wednesday, July 17, 2013 11:09 AM