Validation Rule Help - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Sarah LeeSarah Lee 

Validation Rule Help

Hello all, 

I need some help with these validation rules. They are pretty simple but I'm struggling to get them to work. Any help is appreciated!

1. BFY must be 4 characters and numbers only, if case category meets the criteria. What I have so far:

AND(
ISPICKVAL(Case_Category__c , "Accounts Receivable"),
NOT(ISBLANK(BFY__c)),
OR(
LEN(BFY__c)<>4),
NOT(ISNUMBER(BFY__c)
))

2. Accounting Code must be 15 characters when Case Category, Case Type, and Current Queue meet the criteria. What I have so far:

AND(
OR(
ISBLANK(Accounting_Code__c),
LEN(Accounting_Code__c)!=15),
Approve_Case_Validation__c,
ISPICKVAL(Case_Category__c, "Accounts Receivable"),
ISPICKVAL(Case_Type__c, "Debt - Salary Offset"),
ISPICKVAL(Current_Queue__c, "Payroll")
)

 

Best Answer chosen by Sarah Lee
Anil JAdhavAnil JAdhav
Hi Sarah,
PFB
1. 
AND(
ISPICKVAL(Case_Category__c , "Accounts Receivable"),
AND(
NOT(ISBLANK(BFY__c)),
NOT(LEN(BFY__c)<>4)),
NOT(ISNUMBER(BFY__c)
))

2. 
AND(
Approve_Case_Validation__c,
ISPICKVAL(Case_Category__c, "Accounts Receivable"),
ISPICKVAL(Case_Type__c, "Debt - Salary Offset"),
ISPICKVAL(Current_Queue__c, "Payroll"),
OR(
ISBLANK(Accounting_Code__c),
LEN(Accounting_Code__c)!=15)
)

Can you please check

Regards,
AJ

All Answers

Anil JAdhavAnil JAdhav
Hi Sarah,
PFB
1. 
AND(
ISPICKVAL(Case_Category__c , "Accounts Receivable"),
AND(
NOT(ISBLANK(BFY__c)),
NOT(LEN(BFY__c)<>4)),
NOT(ISNUMBER(BFY__c)
))

2. 
AND(
Approve_Case_Validation__c,
ISPICKVAL(Case_Category__c, "Accounts Receivable"),
ISPICKVAL(Case_Type__c, "Debt - Salary Offset"),
ISPICKVAL(Current_Queue__c, "Payroll"),
OR(
ISBLANK(Accounting_Code__c),
LEN(Accounting_Code__c)!=15)
)

Can you please check

Regards,
AJ
This was selected as the best answer
Jayson MoralesJayson Morales
Hi Sarah,

You can try these formula:

1. 
AND(
ISPICKVAL(Case_Category__c , "Accounts Receivable"),
ISBLANK(BFY__c),
LEN(BFY__c)<>4,
NOT(ISNUMBER(BFY__c))
)

2. 
AND(
ISBLANK(Accounting_Code__c),
LEN(Accounting_Code__c)<>15,
Approve_Case_Validation__c,
ISPICKVAL(Case_Category__c, "Accounts Receivable"),
ISPICKVAL(Case_Type__c, "Debt - Salary Offset"),
ISPICKVAL(Current_Queue__c, "Payroll")
)

Hope that helps.

Regards,
Jayson
 
Sarah LeeSarah Lee

Thank you both! I ended up with this for the first one, it needs to fire if any of these are true:

AND(
ISPICKVAL(Case_Category__c , "Accounts Receivable"),
NOT(ISBLANK(BFY__c)
),
OR(
LEN(BFY__c)<>4,
NOT(ISNUMBER(BFY__c)
)))