With legacy web client being deprecated for Power Apps & Dynamics 365, organizations need to move to Unified Interface. There are a lot of changes needed for your applications to be compatible with Unified Interface, this article will help you make the needed changes for all your custom ribbon buttons
If you have custom JavaScript commands for ribbon buttons, you need to update the client API code references from Xrm.Page to formContext (as Xrm.Page has been deprecated as well)
To pass the form context from the ribbon button action,
Update the button command in Ribbon Workbench and pass Primary Control as CRM parameter
Go to the custom rule for the command and click on Add Parameter
Select ‘CRM Parameter’ from the options
Select ‘Primary Control’ from the list
After this, update your JavaScript functions with the primaryControl variable as an argument. This argument provides the form context where the ribbon command is executed.
An example for the updated script for button command in Unified Interface
Old Code
function showButton(){
var status = Xrm.Page.getAttribute("new_status").getValue();
if (status == 1) {
return true;
}
else return false;
}
Updated Code
function showButton(primaryControl) {
var formContext = primaryControl;
var status = formContext.getAttribute("new_status").getValue();
if (status == 1) {
return true;
}
else return false;
}
Updating Flyout buttons for Unified Interface:
For flyout buttons, in addition to updating the JavaScript commands as shown above, the function to populate the flyout options needs to be updated as well.
· Pass the primary Control along with command properties to the populate xml function
Comments