Views:

Overview

In this KB article, we want to users to be able to submit an Opportunity for approval.  As some users may not have permission to change the status of Opportunities, we have created a Quick Button that will circumvent this restriction.

We also want to ask the user for confirmation before changing the status. 

Note: The opportunity we use in this example has a custom status reason call Pending Approval. 

North52 Decision Suite

The North52 Decision Suite solution works like this:

  • A Formula is set up on the Opportunity which:
    • Prompts the User for approval submission
    • Updates the Status Reason to Pending Approval if the User confirms
    • Refreshes the form so that the User can see the change 
  • A Quick button is created that calls this formula

Set up Formula and Quick Button

Formula

  • Create a new formula, setting the following values in the Formula Guide:
    • Source Entity set to Opportunity
    • Set Formula Type to Clientside - Calculation
    • Select the Decision Table editor
    • Select Create
  • Change the Name of the formula to Submit for Approval
  • Click Save

In this formula we will create 3 Decision table sheets:

  • Click on the Decision Table editor
  • Right-click and select Insert > Insert Decision Table
  • Repeat this so you have 3 Decision Table sheets
  • Rename the first sheet by double clicking its name and entering the text DisplayConfirmMsg 
  • Rename the second sheet by double clicking its name and entering the text Logiccode1
  • Rename the third sheet by double clicking its name and entering the text FinalRefresh

DisplayConfirmMsg Sheet

  • On sheet DisplayConfirmMsg, click on the Decision table editor
  • Right-click and select Operations > Toggle Advanced Mode
  • Select cell A2 and enter the text Confirm Dialog
  • Select cell A3 and enter the text [opportunity.n52confirmdialogresult]
    • Note this is an internal virtual field for North52, it doesn't exist outside the context of this formula
  • Select cell A4
    • Go to the Functions tab and search for DoesNotContain
    • Ctrl-click the function DoesNotContainData
  • Select cell B2
    • Enter the text Display Confirm Message
  • Select B4
    • Enter the following text:
      ConfirmDialog('Are you sure you want to submit for approval?','Confirmation Dialog','SubmitApproval','Ok','Cancel',200,400)
  • Right click and select Hit Policy > Exit All Decision Tables on First Match

LogicCode1 Sheet

  • On sheet LogicCode1, click on the Decision table editor
  • Select column B
    • Right-click and select Insert > Insert Action
  • Select cell A2 and enter the text Confirm Dialog Result
  • Select cell A3 and enter the text [opportunity.n52confirmdialogresult.?]
    • Note this is an internal virtual field for north52, it doesn't exist outside the context of this formula
  • Select cell A4 and enter the text 'SubmitApproval-true'
  • Select cell A5 and enter the text 'SubmitApproval-false'
  • Select cell B2
    • Go to Source tab
    • Find Status and select it 
  • Select cell B4
    • Go to Source tab
    • Find and expand Status
    • Select Open
  • Select cell C2
    • Go to Source tab
    • Find Status Reason and select it 
  • Select cell C4
    • Go to Source tab
    • Expand Status Reason
    •  Select Pending approval
      • Note this is a custom status reason
  • Click Save
     

FinalRefresh Sheet

  • On sheet FinalRefresh, click on the Decision table editor
  • Select column B
  • Right-click and select Delete > Delete Column
  • Select cell A2
    • Enter the text Refresh Form
  • Select cell A4
    • Enter the text RefreshForm('true')
  • Click Save
     

Quick Button

Please see the article here for instructions on how to add a Quick Button to a form. 

Testing

To test this formula, have a User open an Opportunity and click the button. They will be prompted to confirm submission for approval.

 

Did you know?

North52 has over 500 functions to help you implement advanced business rules and complex decision logic

One of the biggest costs on most Microsoft Dynamics 365/CRM project is custom coding. This is where consultants or developers are invloved in writing 100’s if not thousand’s of lines of code in Javascript and/or C#.

The Formula Manager, part of the North52 Decision Suite is a business rules engine that aims to eliminate this custom coding by using simple formulas instead. It is significantly faster (up to 10 times) than writing custom code and you get the added bonus of lower cost updates if a business rule changes in the future (it is much faster and thus cheaper to change it using a Formula rather than custom code).

There are over 500 functions available in the North52 Decision Suite business rules engine!

Learn more about North52 Business Process Activities