Scenario Overview
This article will show how to add a North52 Dynamic Quick Button to a Power Pages Form. A Dynamic Quick Button is one that will load from a North52 formula and can be configured to show different options when the form loads.
This means that you can customize the buttons available to users based on your business rules.
Our scenario requires that if an existing Case is more than 2 days old, we want to show customers a button to escalate their Case.
If the Case is less than 2 days old then the escalation button will be visible on the form but will be disabled.
The escalation process will not be shown as part of this article, only demonstrating how to set up the Dynamics Quick Button for the portal form.
Formula
Setup
- Create a new formula, setting the following values in the Formula Guide:
- Source Entity set to Case
- Set Formula Type to ClientSide - Calculation
- Select the Decision Table editor
- Click the Create button
- Set the Name to Case - Portal - Display Escalation Button
- Set the Source Property to be Portal Quick Button on the Web - Edit Case form
- Set Portal Deployment to specify the portal you are using e.g Customer Self-Service, Community Portal etc.
- Click Save
Note: If you are using any North52 Quick Buttons on a Portal form that does not contain any other formulas you must use Portal Quick Button in the source properties and specify the portal.
Configure the Decision Table
- From the Decision Table command bar select Snippets > Quick Button
- Set up the Conditions:
- Select cell A2, go to the Source tab and search for created
- Expand the Source node
- Select Created On
- Select cell A4, go to the Functions tab and search for contains
- Ctrl-click the ContainsData function
- Select column B, right-click and select Insert > Insert Condition
- Select cell B2, go to the Function tab and search for datediff
- Shift-Click on the DateDiff function
- On the pop-up menu, set the Friendly Name to be Age in Hours
- Click on the search button beside From Date and select Created On
- Select To Date field and then click on the Functions tab and search for utcdatetime
- Click on the UtcDateTime() function to add it into the To Date field.
- Change the Interval drop-down to Hours and then click the Generate button
- Select cell B4 and enter >48
- Select cell A2, go to the Source tab and search for created
- Select column C, right-click and select Insert > Insert Condition
- Select cell C2
- Go to the Source tab
- Find and select Status
- Select cell C4
- Expand Status and select Active
- Set up the Button
- Select cell F4 and replace the default DefaultLabel 'ClickMe' with 'Escalate Case'
- Select cell H4 and replace the default ClickShortCode 'abc' with the shortcode of the pre-created escalation formula
- Select cell K4 and replace the default of 'btn btn-basic' to 'btn btn-danger'
- Highlight the contents of Row 4 and copy it into Row 5
- Change the value in cell B5 from >48 to <48
- Change the value in cell N5 from 'false' to 'true'
- Select the second Decision Table sheet called DecisionTable
- Click Save
- The Decision Table should look like this:
Adding a Quick Button to the Portal Form
- Open the form while signed into the Portal with Administrator access
- Click on the Edit button in the administrator pop-up
- Select Language Content and then click on the Source button
- In the Source pop-up box paste the following piece of HTML into the editor:
<div class="n52_quickbutton" data-n52qbtype="button" data-n52qbparams="[params]"></div>
- Replace the [params] text with the short code of the button formula you want to call
- When you click okay nothing will be shown in the text box for now:
- Click the Save icon which will close the editor
Testing