"тнιѕ вℓσg ¢συℓ∂ ѕανє уσυя мσηєу ιƒ тιмє = мσηєу" - ∂.мαηנαℓу

Sunday 6 October 2013

How to Close a Form in CRM 2013 using javascript

With reference to CRM 2013 SDK, following is the code snippet to close the form.
Xrm.Page.ui.close();
Please note the following important points.
"The HTML Window.close method is suppressed. To close a form window you must use this method. If there are any unsaved changes in the form the user will be prompted whether they want to save their changes before the window closes." ( Ref: CRM 2013 SDK )

Whereas if we need to save the record using javascript, we could use the same methods whichwe were using in CRM 2011.
Xrm.Page.data.entity.save( null | "saveandclose" |"saveandnew" );
 
Arguments values:

save()
If no parameter is included the record will simply be saved. This is the equivalent of using the Save command.

save("saveandclose")
This is the equivalent of using the Save and Close command.

save("saveandnew")
This is the equivalent of the using the Save and New command.
( Ref: CRM 2013 SDK )

2 comments:

  1. HI Nice article, i am facing one issue, i have account entity and created one custom entity in the grid on that, i replaced add new button with one web resource due to some reasons and opened the custom entity record from their.

    Now when i save and close them with custom save and close button it navigates me to to Active Account grid instead of that account record itself. please help

    ReplyDelete