Views:

Scenario Overview

In this example we are going to add a North52 Quick Button to a Dynamic Portal Entity Form.  If the Customer field contains an Account, the Quick Button will retrieve the address information from that account and copy it to the beginning of the case's description field. If the the Customer field is not set to an Account then we will display an error message saying that there is no Parent Account to bring information from.

It is expected that you have read and understood the basic articles on how to configure a Decision Table. The primary goal of this article is about setting up a formula for Dynamics Portals and won't be going in to explicit detail on how to configure a Decision Table. If you need to read these articles first, you can take the free training course BPA - Decision Table Basicshttps://support.north52.com/training

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 - Get Account Address Quick Button 
    • Set the Source Property to be Portal Quick Button for the Web - Create Case Events form
    • In Deployment Settings, select the appropriate portal from the list in Portal Deployment 
    • Click Save

Configure the Decision Table

  • Set up the Conditions
    • Select cell A2, go to the Source tab and search for customer
    • Expand the Source node
    • Select Customer
    • 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 Source tab
    • Select Customer Type
    • Select cell B4
    • Type 'account'
  • Set up the Actions
    • Select cell C2, go to the Source tab and search for desc
    • Select Description 
    • Select cell C4, expand the formula editor canvas for the cell
    • Go to the Source tab and clear the search
    • Expand the Related (N:1) > account (customerid) > (attributes) nodes
    • Select the Address 1 composite field to add [incident.customerid.address1_composite.?] to the editor
    • Type a space then + '\r\n\r\n' + followed by another space
      • Note: The /r/n syntax puts a new line into the description field
    • Clear the Source search and type desc
    • Expand the Source node and select Description
    • Close the cell editing canvas
    • Select column D, right-click and select Insert > Insert Action
    • Select cell D5, go to the Functions tab and search for setform
    • Shift-click the SetFormNotification function to show the wizard
      • Friendly Name: Ignore
      • Message: Type There is no parent account to bring address information from
      • Level: Select ERROR
      • Unique ID: Type msg2
  • 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
  • In the example below we will add the button above the Title field. Mouse over the Copy text area and click the EDIT button

     
  • This will open the Edit Copy editor

     
  • Click on the Source icon to switch to the HTML editor mode

     
  • Paste the following piece of HTML into the editor

    <button class="btn btn-primary n52button" data-n52button="[params]" type="button">[Button Text]</button>

  • Replace the [params] text with the short code of the formula you want to call
    • Example: We want to call a formula with a shortcode of u1Z and the button text will be labelled Add Address Info
      <button class="btn btn-primary n52button" data-n52button="ulZ" type="button">Add Address Info</button>
      

  • Click on the OK button. A button is now showing in the editor

     
  • Click the Save icon which will close the editor

     
  • When the page reloads the button will be shown on the form

     

Note: You can add multiple quick buttons into the save div using this method:
<div class="n52_quickbutton" data-n52qbtype="button" data-n52qbparams="u1Z|Add Address Info|btn btn-primary;abc|Escalate Case|btn btn-danger "></div>
This would create 2 buttons in the div.
 

Testing

  • Refresh the page and then click on the button to trigger the formula