Please wait, loading...

 

Pass executionContext or formContext from Ribbon WorkBench button in UCI Unified client interface

August 22, 2020

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

  1. Open Ribbon WorkBench
  2. Select Solution contains entity and components
  3. Add button, Add command
  4. Now add Javascript Action and select Javascript and Function
  5. Now Click on Add Parameter
  6. Add CRM Parameter

  7. 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 ");
}
https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651&ssl=1
Microsoft Dynamics Community Profile

Learn more