1

I need to create a validation rule as per below criteria,

enter image description here

The Premium adjtment % , is depends upon two above fields, the caalculation is " Adjustment Tech Premium - Technical premium / Technical Premium". The formula has not been created in SF and its coming from a different system. What i need is, that If ,

Premium adjustment % is > 5 % ( only UW 2 group of users can able to modify the record and save it)

Premium adjustment % is > 10 % ( only UW 5 group of users can able to modify the record and save it)

Premium adjustment % is > 20% ( only UW 6 group of users can able to modify the record and save it)

Premium adjustment % is > 30 % ( only UW 7 group of users can able to modify the record and save it)

Can anybody plz suggest, how i can able to make this validation formula, with creating the specific group and adding it to the formula. Each group may have 2 4 spcific users. Thanks

2

Use Custom Permissions. This lets you assign those permissions via permission set. Your rules can then look like this:

IF($Permission.PMLIMIT30,
   Premium_Adjustment__c > 30,
   IF($Permission.PMLIMIT20, 
      Premium_Adjustment__c > 20,
      IF($Permission.PMLIMIT10, 
         Premium_Adjustment__c > 10,
         IF($Permission.PMLIMIT05, 
            Premium_Adjustment__c > 5,
            Premium_Adjustment__c > 0))))

The "highest" permission is considered first, in cascading order. Feel free to adjust it as necessary.


Edit: Thinking about it, I may have the intention backwards. Maybe you want this instead:

IF(Premium_Adjustment__c > 30, 
   NOT($Permission.PMLIMIT30),
   IF(Premium_Adjustment__c > 20,
      NOT($Permission.PMLIMIT20),
      IF(Premium_Adjustment__c > 10,
         NOT($Permission.PMLIMIT10),
         IF(Premium_Adjustment__c > 5,
            NOT($Permission.PMLIMIT5),
            FALSE))))
4
  • Thank you, Let me check this one as well, so i need to create custom permission for the user group. – sourav Jan 9 '17 at 5:32
  • rather than creating roles. – sourav Jan 9 '17 at 5:32
  • @sourav You can assign a permission set to individual users, no need to create roles or public groups. Since you're basically defining the permission (e.g. the ability to edit a record based on permission), this seems like the natural solution to your problem. – sfdcfox Jan 9 '17 at 5:34
  • @sourav Basically, (a) create custom permissions, (b) create permission sets, (c) assign users to permission sets, and (d) implement validation rule. – sfdcfox Jan 9 '17 at 5:35
1

It may be easier for you to make 4 separate rules and then combine them but basically you want to say if % is > 5% and current user ($User) is not in group. The problem you may have is that I've never seen in a validation rule a reference to groups. You can do role or profile or a checkbox on the user record but I can't seem to find where you can get to group so you may need to rethink that part.

Something like this will give you the reference to the user and the premium adjustment field:

OR(
 AND(
  Premium_Adjustment__c > 5,
  $User.Profile.Name <> 'Group 1'
 ),
 AND(
  Premium_Adjustment__c > 10,
  $User.Profile.Name <> 'Group 2'
  $User.Profile.Name <> 'Group 3'
 )
)
4
  • Hi Dan, Thanks for the suggestion. Let me try this. I will create roles and assign to the users then. ( I think roles would be much easier then profile, as profiles has already been set for some users as system admin. ). Also, got a new requirement that, the validation rule will work only when other users want to change the " Adjusted technical premium" field and try to save the records. So, i think i need to add that field in my validation rule, isnt it ? Thanks – sourav Jan 9 '17 at 4:12
  • Hi Dan. I created as Role. Just a query. Should i use " $User.UserRole.Name='UW 2'" or " $User.UserRoleId.Name<>'UW 2' ". UserRole.Name or UserRoleID.Name ? Thnx – sourav Jan 9 '17 at 5:01
  • Use <> because validations fire when they are true. So if you did = then it would stop the people you want to edit. – Dan Wooding Jan 9 '17 at 14:36
  • Thanks Dan, I tried both the ways suggested here ( by sfdcfox as well) & both ways worked. – sourav Jan 12 '17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.