How to Pass Parameters to a Button in Power Apps Dynamics 365

Leave a comment

In this post, we will look at how to add a button to a Dynamics 365 Power Apps Form that receives parameter data.

First, let’s look at passing context.

Create a new JavaScript web resource and add it to the Account form.

We will add the sample code below, which takes PrimaryControl as the first parameter, and if the name of the account is Contoso, sets the website field:

You can grab the code from the link here.

Now, add the web resource to the Account form:

Next, create a new solution and add an entity that will contain the new button. We will do this on the Account entity:

Next, open XrmToolbox and open the Ribbon Workbench solution:

Load your solution:

You will see:

We will add a new button to the Account Form:

Create a new Command:

Add a new JavaScript action:

Select our web resource and enter the function name to call:

Now select a CRM Parameter:

And select PrimaryControl. This will be passed to our JS function:

Publish:

Now, refresh the Account form and you will see the new button:

In the debugger, we are getting the Primary Control:

And the code runs as expected:

To pass other parameters, we can simply select these from Ribbon Workbench:

With the ability to type in the values:

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

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