Views:

Scenario Overview

In this example we are going to add a North52 Quick Tile to a Dynamics Portal Entity Form.  If the Customer field contains an Account, the Quick Tile will retrieve the number of remaining allowed cases in their Entitlement and display that data to the customer.

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 - Quick Tile - Remaining Entitlements 
    • Click on the Snippets drop down and select Quick Tile 
    • Click Save
    • Select Portal Quick Tile for the *** Web - Create Case Events *** form in the Source Property drop-down
    • In Deployment Settings node select the portal where you want to deploy this formula to from the Portal Deployment drop-down
    • Go to the Fetch-Xml tab and click on the plus (+) icon
    • In the new window that opens set the Name to be Remaining Terms on Number of Cases Entitlement
    • For Query copy the following Fetch-XML (note the @customerid@ placeholder which dynamically modifies the query at runtime to filter by the relevant customer):
      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
        <entity name="entitlement">
          <attribute name="name" />
          <attribute name="createdon" />
          <attribute name="entitytype" />
          <attribute name="entitlementid" />
          <attribute name="remainingterms" />
          <order attribute="name" descending="false" />
          <filter type="and">
            <condition attribute="statecode" operator="eq" value="1" />
            <condition attribute="customerid" operator="eq" value="@customerid@" />
            <condition attribute="entitytype" operator="eq" value="0" />
            <condition attribute="allocationtypecode" operator="eq" value="0" />
            <condition attribute="remainingterms" operator="gt" value="0" />
          </filter>
        </entity>
      </fetch>
    • Click Save & Close

Configure the Decision Table

  • Set up the Conditions
    • Select column A, right-click and select Insert > Insert Condition 3 times
    • 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 cell B2, go to the Source tab
      • Select Customer Type
    • Select cell B4
      • Enter 'account' 
    • Select cell C2, go to the Functions tab and search for FindValueFD function
      • Shift-click the FindValueFD function and a wizard will appear:
        • Set the Friendly Name to be Remaining Cases
        • In the Formula Detail (Query) field select the Fetch-Xml you created earlier
        • In Field Name select remainingterms 
        • Put 0 (zero) in the Default Value field
        • Click the Generate button
    • In cell C4 enter the value (zero)
  • Set up the Tile
    • Select cell D4 and delete the default value that was added
      • Go to the Functions tab and search for truncate
        • This function is used to remove decimal values and entitlements can return as 5.0000000000 of which we only want the value 5
      • Shift-click on the Truncate function
        • Click on the Input Value field in the wizard then go to the Source tab and expand the Global Calculations node and select Remaining Cases 
        • You can leave the other Friendly Name field blank
    • Select cell E4 and set the ResultColor-1 to 'black' 
    • Select cell F4 and set the Title-1 to Remaining Cases 
    • Select cell G4 and set the Icon-1 to be 'glyphicon-th-list' 
    • Select cell H4 and set the TileColor-1 to be 'red' 
    • Cells I4 and J4 should contain two single quotes only: ''
    • Copy the contents of Row 4 into Row 5 and Row 6
    • Select cell C5 and enter ((1,3))
    • Select cell H5 and set the value of TileColor-1 to 'orange'
    • Select cell C6 and enter >3
    • Select cell H6 and set the value of TileColor-1 to 'green'
  • Click Save
  • The Decision Table should look like this:

Adding a Quick Tile to the Portal Form

  • Open the form while signed into the Portal with Administrator access
  • In the example below we will add the Quick Tile 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 HTML into the editor:
    <div class="n52_tiles" data-n52tile="[shortcode]"></div>
  • Replace the [shortcode] text with the short code of the formula you want to call
    • In this example: We want to call a formula with a shortcode of Yrr (short code of the formula we just created)
      <div class="n52_tiles" data-n52tile="Yrr"></div>
      

  • Click the OK button
  • Click the Save icon which will close the editor

  • When the page reloads the Quick Tile will be shown on the form:

Did you know?

TestShield enables effective test data management

Test data can be easily created from existing records in your system, generating a 'snapshot' of data that represents a valid (or invalid) scenario. This can be easily manipluated and variations created in the Test Data editor to cover valid or invalid test scenarios. Sensitive data can be masked, changed or removed. 

The saved test data is then available to be used when creating your automated tests. It can be reused many times over avoiding repeated effort and maximizing the value of the work done.

Learn more about TestShield