function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phillip MoseleyPhillip Moseley 

Trying to Include Multiple Profile Names in Validation Rule Formula - No Errors, but Rule Not Working

Here is the fomula that I have now. I'm trying to include multiple profile names in the formula so the validation rule error will appear for all profiles. I've gotten it to work if I just have one profile name listed, but I need to account for all the profile names in my example formula below.

IF(AND($Profile.Name == "Field Sales - MD 7132010 - Comm AE,Field Sales - MD 7132010,Field Sales - Higher Ed,Field Sales - Commercial East,Inside Sales", BMXQ__Proposal_Template__r.Name == "LEGAL 1. Order Form: New Customer"),true,false)

Thanks,
 
Suresh RaghuramSuresh Raghuram
as you said you were including multiple names your formula should look like this.

IF(AND($Profile.Name == "Field Sales - MD 7132010 - Comm AE",
            $Profile.Name == "Field Sales - MD 7132010,Field Sales - Higher Ed",
            $Profile.Name == "Field Sales - Commercial East,Inside Sales",
            BMXQ__Proposal_Template__r.Name == "LEGAL 1. Order Form: New Customer"),true,false).

If this answers your question make this as a solution please.

 
Phillip MoseleyPhillip Moseley
Unfortunately the formula below did not trigger the error message either. I did not get any syntax errors, so do you happen to have any other suggestions? Thanks,
Tom FrayTom Fray
I might be missing something here, but if this is a validation rule, then the IF(##, true, false) is implied. So if you remove that, it should work.
I'm also not sure you need the double "=" in declarative formulas.

Here is an example of a validation that works for me:

AND(
ISBLANK( Corp_CompanyID__c ),
RecordType.Name = "Corporate Account"
)

Why don't you try:

AND($Profile.Name = "Field Sales - MD 7132010 - Comm AE",
            $Profile.Name = "Field Sales - MD 7132010,Field Sales - Higher Ed",
            $Profile.Name = "Field Sales - Commercial East,Inside Sales",
            BMXQ__Proposal_Template__r.Name = "LEGAL 1. Order Form: New Customer")
Suresh RaghuramSuresh Raghuram
Hi Philip, 

I believe you requirement might be this.
why I kept all profiles in Or condition is the logged user will under one profile.
At a time he can not fall into more  than one profile and the AND condition for all profiles may not satisfy.
If this answers your question make this as a solution please.

AND(OR($Profile.Name = "Field Sales - MD 7132010 - Comm AE",
            $Profile.Name = "Field Sales - MD 7132010,Field Sales - Higher Ed",
            $Profile.Name = "Field Sales - Commercial East,Inside Sales"),
            BMXQ__Proposal_Template__r.Name = "LEGAL 1. Order Form: New Customer")
 
Phillip MoseleyPhillip Moseley
Tom, Thanks for your response. This validation rule did work, but it’s showing the error on all the available order form templates and not just the Legal 1 Order Form. If possible, I want it to only trigger the error for this one Legal 1 order form. Thanks for any other suggestions! Phillip
Phillip MoseleyPhillip Moseley
Suree, Thanks for your response. This validation rule did work, but it’s showing the error on all the available order form templates and not just the Legal 1 Order Form. If possible, I want it to only trigger the error for this one Legal 1 order form. Thanks for any other suggestions! Phillip
Tom FrayTom Fray
Hi Phillip,

Suree was right to put the OR in there, i missed that. it wouldn't be possible to have all 3 of the profiles at once.

Is this validation on the Parent object of the Order Form object? The __r suggests that it is looking to see if there are any templates with that name, not just the one you are saving, related to the record you are saving.

If that's right, then wouldn't it be best to have the validation on the   BMXQ__Proposal_Template__c object with something like this:

AND(OR($Profile.Name = "Field Sales - MD 7132010 - Comm AE",
            $Profile.Name = "Field Sales - MD 7132010,Field Sales - Higher Ed",
            $Profile.Name = "Field Sales - Commercial East,Inside Sales"),
            Name = "LEGAL 1. Order Form: New Customer")