Help with formula for validation rule on user fields
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
I'm trying to create a validation rule requiring 3 fields to be populated for 3 profiles. Here is what i have so far. I gave up after continued syntax errors. I need both Zone Approver Fields and the Sales Report Label field populated for these 3 profiles. The zone approver fields are type "hierarchy" and the Sales Report Label field is a picklist. Thank you in advance!
AND(OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0),
LEN(Zone_2_Approver__r.Id)=0),
Text(Sales_Report_Label__c)= ""))
validation-rule
New contributor
add a comment |Â
up vote
2
down vote
favorite
I'm trying to create a validation rule requiring 3 fields to be populated for 3 profiles. Here is what i have so far. I gave up after continued syntax errors. I need both Zone Approver Fields and the Sales Report Label field populated for these 3 profiles. The zone approver fields are type "hierarchy" and the Sales Report Label field is a picklist. Thank you in advance!
AND(OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0),
LEN(Zone_2_Approver__r.Id)=0),
Text(Sales_Report_Label__c)= ""))
validation-rule
New contributor
2
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm trying to create a validation rule requiring 3 fields to be populated for 3 profiles. Here is what i have so far. I gave up after continued syntax errors. I need both Zone Approver Fields and the Sales Report Label field populated for these 3 profiles. The zone approver fields are type "hierarchy" and the Sales Report Label field is a picklist. Thank you in advance!
AND(OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0),
LEN(Zone_2_Approver__r.Id)=0),
Text(Sales_Report_Label__c)= ""))
validation-rule
New contributor
I'm trying to create a validation rule requiring 3 fields to be populated for 3 profiles. Here is what i have so far. I gave up after continued syntax errors. I need both Zone Approver Fields and the Sales Report Label field populated for these 3 profiles. The zone approver fields are type "hierarchy" and the Sales Report Label field is a picklist. Thank you in advance!
AND(OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0),
LEN(Zone_2_Approver__r.Id)=0),
Text(Sales_Report_Label__c)= ""))
validation-rule
validation-rule
New contributor
New contributor
edited 46 mins ago
battery.cord
6,42551742
6,42551742
New contributor
asked 47 mins ago
Kelly
111
111
New contributor
New contributor
2
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago
add a comment |Â
2
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago
2
2
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
If your'e trying to check for null values you need to wrap your field with ISBLANK
AND(OR( $Profile.Name ="profile1",$Profile.Name="profile2",$Profile.Name="profile3"),
OR(
ISBLANK(Zone_1_Approver__c),
ISBLANK(Zone_2_Approver__c),
ISBLANK(Text(Sales_Report_Label__c))))
As a best practice try using profile name instead of hard coded Id's
2
That worked! Thank you!
â Kelly
30 mins ago
add a comment |Â
up vote
2
down vote
As written, the formula simply has unbalanced parentheses. Treat formulas like algebra, or Excel formulas - you always must balance parentheses and separate formula parameters with commas.
AND(
OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0), // <--- extra parenthesis
LEN(Zone_2_Approver__r.Id)=0), // <--- extra parenthesis
Text(Sales_Report_Label__c) = ""
)
)
You should also, however, see @codeyinthecloud's answer. It's best practice to use ISBLANK()
on the relationship field itself rather than relying on behavior when you refer across a non-populated relationship. Additionally, it would be best to use a Custom Permission rather than hard-coding profile references.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
If your'e trying to check for null values you need to wrap your field with ISBLANK
AND(OR( $Profile.Name ="profile1",$Profile.Name="profile2",$Profile.Name="profile3"),
OR(
ISBLANK(Zone_1_Approver__c),
ISBLANK(Zone_2_Approver__c),
ISBLANK(Text(Sales_Report_Label__c))))
As a best practice try using profile name instead of hard coded Id's
2
That worked! Thank you!
â Kelly
30 mins ago
add a comment |Â
up vote
2
down vote
If your'e trying to check for null values you need to wrap your field with ISBLANK
AND(OR( $Profile.Name ="profile1",$Profile.Name="profile2",$Profile.Name="profile3"),
OR(
ISBLANK(Zone_1_Approver__c),
ISBLANK(Zone_2_Approver__c),
ISBLANK(Text(Sales_Report_Label__c))))
As a best practice try using profile name instead of hard coded Id's
2
That worked! Thank you!
â Kelly
30 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
If your'e trying to check for null values you need to wrap your field with ISBLANK
AND(OR( $Profile.Name ="profile1",$Profile.Name="profile2",$Profile.Name="profile3"),
OR(
ISBLANK(Zone_1_Approver__c),
ISBLANK(Zone_2_Approver__c),
ISBLANK(Text(Sales_Report_Label__c))))
As a best practice try using profile name instead of hard coded Id's
If your'e trying to check for null values you need to wrap your field with ISBLANK
AND(OR( $Profile.Name ="profile1",$Profile.Name="profile2",$Profile.Name="profile3"),
OR(
ISBLANK(Zone_1_Approver__c),
ISBLANK(Zone_2_Approver__c),
ISBLANK(Text(Sales_Report_Label__c))))
As a best practice try using profile name instead of hard coded Id's
answered 35 mins ago
codeyinthecloud
883216
883216
2
That worked! Thank you!
â Kelly
30 mins ago
add a comment |Â
2
That worked! Thank you!
â Kelly
30 mins ago
2
2
That worked! Thank you!
â Kelly
30 mins ago
That worked! Thank you!
â Kelly
30 mins ago
add a comment |Â
up vote
2
down vote
As written, the formula simply has unbalanced parentheses. Treat formulas like algebra, or Excel formulas - you always must balance parentheses and separate formula parameters with commas.
AND(
OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0), // <--- extra parenthesis
LEN(Zone_2_Approver__r.Id)=0), // <--- extra parenthesis
Text(Sales_Report_Label__c) = ""
)
)
You should also, however, see @codeyinthecloud's answer. It's best practice to use ISBLANK()
on the relationship field itself rather than relying on behavior when you refer across a non-populated relationship. Additionally, it would be best to use a Custom Permission rather than hard-coding profile references.
add a comment |Â
up vote
2
down vote
As written, the formula simply has unbalanced parentheses. Treat formulas like algebra, or Excel formulas - you always must balance parentheses and separate formula parameters with commas.
AND(
OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0), // <--- extra parenthesis
LEN(Zone_2_Approver__r.Id)=0), // <--- extra parenthesis
Text(Sales_Report_Label__c) = ""
)
)
You should also, however, see @codeyinthecloud's answer. It's best practice to use ISBLANK()
on the relationship field itself rather than relying on behavior when you refer across a non-populated relationship. Additionally, it would be best to use a Custom Permission rather than hard-coding profile references.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
As written, the formula simply has unbalanced parentheses. Treat formulas like algebra, or Excel formulas - you always must balance parentheses and separate formula parameters with commas.
AND(
OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0), // <--- extra parenthesis
LEN(Zone_2_Approver__r.Id)=0), // <--- extra parenthesis
Text(Sales_Report_Label__c) = ""
)
)
You should also, however, see @codeyinthecloud's answer. It's best practice to use ISBLANK()
on the relationship field itself rather than relying on behavior when you refer across a non-populated relationship. Additionally, it would be best to use a Custom Permission rather than hard-coding profile references.
As written, the formula simply has unbalanced parentheses. Treat formulas like algebra, or Excel formulas - you always must balance parentheses and separate formula parameters with commas.
AND(
OR(ProfileId ="00e30000001iKyY",ProfileId="00e30000001iKzE",ProfileId="00e30000001iL0B"),
OR(
LEN(Zone_1_Approver__r.Id)=0), // <--- extra parenthesis
LEN(Zone_2_Approver__r.Id)=0), // <--- extra parenthesis
Text(Sales_Report_Label__c) = ""
)
)
You should also, however, see @codeyinthecloud's answer. It's best practice to use ISBLANK()
on the relationship field itself rather than relying on behavior when you refer across a non-populated relationship. Additionally, it would be best to use a Custom Permission rather than hard-coding profile references.
answered 33 mins ago
David Reed
21.8k31640
21.8k31640
add a comment |Â
add a comment |Â
Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f236042%2fhelp-with-formula-for-validation-rule-on-user-fields%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
What were the syntax errors? Other users might have trouble reproducing them exactly
â battery.cord
46 mins ago
They kept changing with every update. I received extra "," here: LEN(Zone_2_Approver__r.Id)=0), which i know i need. Then i would remove it and get a different error missing ")". Also received "extra LEN". Basically every time i changed something that errored i would get a different error.
â Kelly
40 mins ago