Views:

Overview

In this scenario, we require that every User be given the North52 Formula Manager - Standard security role

We shall do this by creating a formula to update the security roles whenever a user is created. 

North52 BPA Solution

The North52 BPA solution works like this:

  • A formula is created that will trigger whenever a new User is created
  • This formula will check to see if this User has been given the North52 Formula Manager - Standard role
  • The formula will assign the role to the User if it does not already have it

Set up Formula

  • Navigate to Settings > N52 Formula
  • Create a new formula, setting the following values in the Formula Guide:
    • Source Entity set to User
    • Set Formula Type to Save - Perform Action
    • Select the Classic Editor
  • Change the Name of the formula to Auto assign North52 security roles to new users
  • Set Event to Create
  • Expand Deployment Settings
  • Set Pipeline Stage to Post-Operation (Asynchronous)
  • Copy and paste the following into the Classic Editor:
    Smartflow(
      SetVar('GuidofRole',FindValue('role', 'name', 'North52 Formula Manager - Standard', 'roleid', '?', true)),
    
      SetVar('NumberofAssociations' ,
        FindCount('systemuserroles',
                  SetFindAnd('roleid','systemuserid' ),
                  SetFindAnd(GetVar('GuidofRole'), [systemuser.systemuserid] ),
                  'systemuserid',
                  '0',
                  'true')),
    
    
      Iftrue( GetVar('NumberofAssociations') <1,
    
        AssociateEntities('systemuser',
                          [systemuser.systemuserid],
                          'role',
                          FindValue('role', 'name', 'North52 Formula Manager - Standard', 'roleid', '?', true),
                          'systemuserroles_association' )))
    
    
  • Click Save

Test

You are now ready to test. To test the formula, create a User. You should see that the Security Role is set automatically as in the image below: