Overview
Using the North52 Quick Button functionality, we can trigger a Power Automate flow from a simple button click. This makes certain tasks more obvious, easier and quicker for end users instead of having to find the specific Flow in the navigation ribbon options.
For this example, we are going to perform a simple operation of capitalizing the Account name.
Rules for Triggering Flow from Button
Rule # | Description |
---|---|
1 |
Users can trigger a Power Automate Flow from a button on the form. |
North52 Decision Suite Solution
The North52 Decision Suite solution works like this:
- A Power Automate Flow is set up with a When a HTTP request is received trigger
- It is set up to expect the Account Id and Account Name as part of the HTTP request
- A ClientSide Calculation Formula is set up on the Account table which:
- Calls the Power Automate Flow using the ExecuteMSFlowRequest function
- The Flow is executed and updates the Account record
Set up Flow, xCache, Formula and Quick Button
Power Automate Flow
We set up a Power Automate Flow that uses the When a HTTP request is received trigger. Use the following sample JSON to generate the schema:
{ "recordId": "58c951fa-ec96-eb11-b1ac-000d3abc3710", "accountName": "example" }
The second step in the Flow, Update a row, uses the values we pass in the JSON payload. recordId for the Row ID, and accountName within the toUpper function that updates the Name column.
The HTTP POST URL is populated once we save the Flow. Copy this value as we will store it in an xCache record in the next section.
xCache
To securely store the HTTP POST URL we use an xCache record. Only System Administrators or specifically authorized users will be able to access this value. Additionally, if we have different values for Dev/Test/Production environments we can use separate xCache values for these and the Formula will use the appropriate value at runtime.
- Open the North52 App
- Navigate to Business Process Activities > N52 xCache
- Create a new xCache record
- Enter PowerAutomate for the Category
- Add HttpPostUrl to the Base Key so that the full BaseKey name is PowerAutomate_HttpPostUrl
- In the Value Information tab enter your HTTP POST URL into the Value (Secured) field
- Click Save
Formula
To create the Formula to trigger the Flow from a Quick Button:
- Open the North52 App
- Navigate to Business Process Activities > Formulas
- Create a new formula, setting the following values in the Formula Guide:
- Source Entity set to Account
- Set Formula Type to ClientSide - Calculation
- Select the Classic editor
- Change the Name of the formula to Account - ClientSide - Execute Flow from Quick Button
- Click Save
- Select the Functions tab and search for Flow
- Click the ExecuteMSFlowRequest function to add the function schema to the Formula editor
- Delete the 'url' placeholder text, and press enter to go onto a new line
- From the Source tab, expand xCache and then the PowerAutomate node
- Select PowerAutomate_HttpPostUrl
- This will add the xCacheGetGlobal('PowerAutomate_HttpPostUrl') function
- Delete the 'body' placeholder text, and press enter to go onto a new line
- We now need to build the JSON payload which will be passed to the Flow:
- Select the Functions tab and search for CreateJObject
- Click the CreateJObject function to add the function schema to the Formula editor
- Within the first CreateJProperty function placeholder type 'recordId' followed by a comma, then from the Source tab, select Source > Account to add [account.accountid] within the function
- Within the second CreateJProperty function placeholder type 'accountName' followed by a comma, then from the Source tab, select Source > Account Name to add [account.name] within the function
- Tidy the function formatting (select all of the Formula then select the Shift + Tab keys), so that it looks like this:
ExecuteMSFlowRequest( xCacheGetGlobal('PowerAutomate_HttpPostUrl'), CreateJObject( CreateJProperty('recordId', [account.accountid]), CreateJProperty('accountName', [account.name]) ) )
- Click Save and make a note of the Formula Short Code
Quick Button
On your Form, add the north52_quick_button_unified_interface.htm web resource in the desired location, setting the parameters like below (you will need to use your Formula Short Code):
Testing
Open your Account record and click the North52 Quick Button to run the Flow.
Refresh the form to see the changes:
Review the Flow run: