Scenario Overview
Note: This functionality will be publicly available in the next release expected in early September
This scenario will demonstrate how to change the options available in a pick list depending on who the user is.
The business requirement here is that the Category pick-list on the Account form will display different pick-list values depending on what security roles have been assigned to the logged on user.
Matrix of Security Roles to Option Set Values
- Everyone - Standard Customer
- Salesperson - Standard Customer, Internal Customer, Local Customer, International Customer
- Sales Manager - Sames as Salesperson and Preferred Customer
- Marketing Manager - Standard Customer, Advertising Client, Advertising Partner
- System Administrator - All Options
OptionSet Values:
- Internal Customer - 100000001
- Local Customer - 100000002
- Standard Customer - 2
- International Customer - 100000003
- Preferred customer - 1
- Advertising Client - 100000004
- Advertising Partner - 100000005
OptionSet view for System Administrator
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A Formula of type 'ClientSide - Perform Action' is created on the Account entity
- The triggering event is the 'Create & Update'
- The Source Property is set to 'OnLoad'
- The Formula first sets which picklist options should be be visible for each user
- The AvailableOptions starts with 2 since every user should be able to choose Standard Customer
- Next each Security Role is checked for and if found the list of AvailableOptions is increased.
- Finally the formula removes the trailing comma from the list and sets the picklist values on the Account
*Note: A comma is added at the end of each option set list so they can be added together correctly, then the final trailing comma is removed by the Trim() function
North52 Decision Suite Steps
The following set of steps outline how to create this Formula
- Create a new formula of type 'ClientSide - Perform Action'
- Set the Source Entity to 'Account'
- Set the Event to 'Create & Update'
- Copy and paste the formula below into the formula
- Click Save
- Click N52 Commands and then Publish
- Time to test
OptionSet View for a Salesperson
Formula
Smartflow(
SetVAr('VisibleOptionsForSystemAdmin', '1,2,100000001,100000002,100000003,100000004,100000005,'),
SetVar('VisibleOptionsForSalesPerson', '100000001,100000002,100000003,'),
SetVar('VisibleOptionsForSalesManager', '100000003,100000004,100000005,100000006,'),
SetVar('VisibleOptionsForMarketingManager', '1,2,'),
SetVar('AvailableOptions', '2,'),
IfTrue(IsUserInSecurityRoles(WhoAmI(), 'System Administrator'),
SetVarConcat('AvailableOptions',
GetVar('VisibleOptionsForSystemAdmin'))),
ifTrue(IsUserInSecurityRoles(WhoAmI(), 'Salesperson'),
SetVarConcat('AvailableOptions',
GetVar('VisibleOptionsForSalesPerson'))),
iftrue(IsUserInSecurityRoles(WhoAmI(), 'Sales Manager'),
SetVarConcat('AvailableOptions',
GetVar('VisibleOptionsForSalesManager'))),
iftrue(IsUserInSecurityRoles(WhoAmI(), 'Marketing Manager'),
SetVarConcat('AvailableOptions',
GetVar('VisibleOptionsForMarketingManager'))),
SetVar('AvailableOptions', Trim(GetVar('AvailableOptions'), ',')),
SetPickListValues('accountcategorycode', true, GetVar('AvailableOptions'))
)