Pass executionContext or formContext from Ribbon WorkBench button in UCI Unified client interface
Views (1722)
With Depreciation of xrm.page which was used to get attribute/property of an item of form. We all have switched to the latest FormContext which require executionContext need top be passed as a Parameter "Pass Execution Context as First Parameter" from event
Now how to pass ExecutionContext for the javascript action used for a Button on Ribbon Workbench
From Event Handler Property we can simply enable checkbox “Pass execution context as first parameter ” and use that for Form Context as Below

And we can get FormContext from 1st parameter Execution Parameter.
function readXML(executionContext) {
if (executionContext !== null) {
formContext = executionContext.getFormContext();
}
alert("executionContext is null ");
}
How to Pass ExecutionContext or FormContext for a JS action on the button in Ribbon Workbench
- Open Ribbon WorkBench
- Select Solution contains entity and components
- Add button, Add command
- Now add Javascript Action and select Javascript and Function
- Now Click on Add Parameter

- Add CRM Parameter

- and select Primary Control

1 thing to remember, like for Form Button , always use PrimaryControl as Form Control
function readXML(executionContext) {
if (executionContext !== null) {
formContext = executionContext; //PrimaryControl
}
alert("executionContext is null ");
}

Like
Report
*This post is locked for comments