Scenario Overview

In this scenario we have a business rule that needs to validate that when a user creates an Opportunity Product (line item) that only one record can exist per Opportunity when a specific price list is selected.

In the screenshot below you can see that the system stops the user from entering in a second line item because the Price List is set to 'CRM Service USA (sample)'


North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • A server-side validation rule is set to execute when an Opportunity product record gets created
  • The formula first checks the price list to see if its the one we are concerned with 
  • And if so it then checks the existing count of line items
  • If this count is greater than or equal to one it will stop the create record and show an error message to the user

North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'Validation'
  • Set the Source Entity to 'Opportunity product '
  • Set the Mode to 'Server-Side'
  • Set the Source Property to 'All Properties'
  • Copy & paste the formula below into the formula 
  • Click save & test


if( FindValue('opportunity', 
               [opportunityproduct.opportunityid] , 
              'pricelevelidname')  = 'CRM Service USA (sample)'  and 

                      [opportunityproduct.opportunityid] ,
                     'opportunityid', '0', false) >= 1,

               'You can only have 1 line item if the parent 
                opportunities price list is set to CRM Service USA (sample) ', 

'NoOp' ) 

Wizard - FindCount

Please see below the wizard you can use to create the FindCount() function call used in this formula. 

Note to find the value for Equals Value, you will need to go to the Source tab and search for the value. 

Did you know?

Decision Tables Simplify Complex Logic

Decsion Tables allow you manage complex business logic without code.  Key features include:

  • Simple visualization in a compact table format
  • Promotes grouping of rules in a single table
  • Business logic can be controlled by domain experts

A Decision Table represents multiple related business rules by using conditions, actions and data values in a spreadsheet-style table. The Decision Table uses columns for the conditions and actions of the rules and rows to represent the associated data values.

Learn more about Decision Tables