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
gdhgdh 

Cross Object Validation rule

I'm trying to create a cross object validation rule that will prevent the creation of a "Case" with a given "Priority" dependent on a field on the Account record.   This is what I have so far,  but it doesn't prevent me from creating a Priority 1 case for a Non-Retainer account. 

 

/* If account Retainer status is Non Retainer AND
Priority is Sev 1 or 2 - throw error */
AND(false,
  ISPICKVAL(Account.Retainer_Status__c, 'Non-Retainer'),
  OR( ISPICKVAL(Priority, '1. High-System Down'),
      ISPICKVAL(Priority, '2. Medium-System Severely Impaired')
    )
)

 

Any suggestions would be appreciated. 

Thanks in advance!

-Gareth

kevin lamkevin lam

Can I ask why did you put "false" in the error condition? It renders the other conditions obsolete.

gdhgdh
Can't say for sure, I'm a point and click admin not a developer by any stretch, this was some code that I found and try to tweak.
Should I just delete "False"? So that it reads:

/* If account Retainer status is Non Retainer AND
Priority is Sev 1 or 2 - throw error */
AND(
ISPICKVAL(Account.Retainer_Status__c, 'Non-Retainer'),
OR( ISPICKVAL(Priority, '1. High-System Down'),
ISPICKVAL(Priority, '2. Medium-System Severely Impaired')
)
)



[cid:image001.jpg@01CEE582.BFC0DD00]




Gareth D. Hernandez
Business Analyst
SmartDog Services, LLC

504.585.7512 Office * 504.430.9612 Cell
800.328.1251 SmartDog Support
800.309.1213 Administrative Assistance
gdh@smartdogservices.com
www.smartdogservices.com

This email may be confidential, may be legally privileged, and is for the intended recipient only. Unauthorized access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited. Please delete if obtained in error and email confirmation to the sender.
kevin lamkevin lam

Yes, I think that should work.

kevin lamkevin lam

Also, if you want this rule to work for new cases only, add ISNEW() to your error conditions.

gdhgdh
No we would also like to prevent Non-Retainer customer's cases from being modified to Priority 1 or 2



[cid:image001.jpg@01CEE583.D54B2030]




Gareth D. Hernandez
Business Analyst
SmartDog Services, LLC

504.585.7512 Office * 504.430.9612 Cell
800.328.1251 SmartDog Support
800.309.1213 Administrative Assistance
gdh@smartdogservices.com
www.smartdogservices.com

This email may be confidential, may be legally privileged, and is for the intended recipient only. Unauthorized access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited. Please delete if obtained in error and email confirmation to the sender.
@anilbathula@@anilbathula@

Hi

Just remove false from the validation rule.
It will work as you desired.
AND(ISNEW(),
ISPICKVAL(Account.Retainer_Status__c, 'Non-Retainer'),
OR( ISPICKVAL(Priority, '1. High-System Down'),
ISPICKVAL(Priority, '2. Medium-System Severely Impaired')
)
)

gdhgdh
Ok so it is now working directly in SFDC. Will it also validate when a customer creates a CASE in our Customer Portal?
-Gareth



[cid:image001.jpg@01CEE585.0EBD4860]




Gareth D. Hernandez
Business Analyst
SmartDog Services, LLC

504.585.7512 Office * 504.430.9612 Cell
800.328.1251 SmartDog Support
800.309.1213 Administrative Assistance
gdh@smartdogservices.com
www.smartdogservices.com

This email may be confidential, may be legally privileged, and is for the intended recipient only. Unauthorized access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited. Please delete if obtained in error and email confirmation to the sender.
@anilbathula@@anilbathula@
Hi gdh,

Yes the validation rule work for customer portal also same like the regular application in sales force.