0

I'm trying to create a validation rule that accomplishes the following:

I have 2 profiles, profile#1 has a page layout with a field (checkbox) that comes "checked" by default.

For profile#2 I created the same page layout but took off the checkbox field (checkbox field is only relevant for Profile#1, in fact everyone at profile#1 needs to check that field, that is why its mandatory).

I tried playing this out by only assigning different page layouts, but every record (regardless if created by profile#1 or profile#2) is being "check marked" on that box. I need a validation rule that somehow requires the profile#1 to check it, but not profile#2, how can I accomplish that?

  • Whenever a requirement that has profile dependencies comes along, I usually consider hierarchy custom settings first. Is that an option for you? – John Thompson Dec 27 '17 at 1:36
1

I'm not sure a validation rule is what you need. It sounds like for profile 1 the box should always be checked and for profile 2 it should never be checked. For something like that you want to set the default value to unchecked.

Once you do that, you can remove the checkbox from the layout altogether and create a workflow/process to automatically check the box if the user has profile one. For profile 2, just don't do anything. This way, you save profile 1 users some effort (as they no longer have to check it manually) and enforce your data policies.

Step 1

Bonus: Naming conventions for processes vary person to person but it seems most people prefer a detailed name to help emphasize what the process is doing so name your process something like Campsite Field Update: Checkbox Name where Campsite is the name of the object and Checkbox Name is the field. Make sure to add detailed descriptions as well. If you use a ticketing system adding the ticket number to the description may also help provide context.

Then select your object, in this case I'm using campsite as it's a bogus object. Select whether it should happen on create or create AND edit. (if profile 2 creates the record, it will be false, but when profile 1 edits the record, should it be set to true or stay false?).

Step 2

Use the following formula as a guide for your criteria.

Step 3

Then, just create an action to set the value of the field.

  • 2
    $Profile.Name = 'Profile1' is better, no ids – cropredy Dec 27 '17 at 2:40
0

When you are creating the checkbox, mark this as unchecked.

Validation rule logic will be like this to show error message.

$Profile.Name == 'Profile1' && Checkbox__c == false

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.