Home › Dynamics 365 Customer Engagement (CRM) › Passing Context from a Toolbar Button in Dynamics 365 UCI
Dynamics 365 Customer Engagement (CRM) · Apr 21, 2019

Passing Context from a Toolbar Button in Dynamics 365 UCI

In this post, we will look at how to pass context from a toolbar button in Dynamics 365 in the Unified Client Interface (UCI).

Let’s add a custom button to the Contact form and call a JavaScript which will pass the context.

First, let’s create a new JavaScript web resource:

We will pass the context as the first parameter:

Code:

function UpdateFN(context) {
     var a = context.getAttribute("firstname").setValue("UPDATED");
}

Save and publish the file.

Open the Ribbon Workbench and select a solution with Contacts:

Add a new button:

And add a new Command:

Add a JavaScript action:

Lookup the new Web resource we created, and enter the function name to call:

Then select Add Parameter:

Select PrimaryControl:

Now set the Button to use the command:

Click Publish in the Ribbon Workbench.

Now let’s go to a contact. Click on the button, and we see the first name has been updated:

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Carl de Souza
KEEP LEARNING. KEEP BUILDING.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.