As Microsoft has deprecated Xrm.Page, we have recently
required to correct our JavaScript code where we use Xrm.page.
For example we have used Xrm.page.data.save method
multiple places in our JavaScript customization code, which we have to replace
with formContext.data.save. The JavaScript functions which are getting called
from the form or field event it is easy to pass the execution context.
In case of the functions which are getting called on
click of Ribbon button is explicitly requires to pass the CRM parameter using
Ribbon Workbench customization, below are the steps which needs to follow the
same-
1. Load
the solution in Ribbon Workbench
2. Choose to modify
the Command for this custom Name button and click on Add Parameter
3. After
selecting the Add Parameter, select CRM Parameter:
4. Select
Primary Control from the dropdown
Now you can get formContext from this parameter as easily as if
it were the executionContext.
Here is code example if you are calling function on lick on Form
Ribbon button
function ribbonButtonClick(executionContext)
{
executionContext.data.save();
}
No comments:
Post a Comment