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
msglsmomsglsmo 

Help With Validation Rule for Case and Custom Object

Good Evening, All,

I know that I am missing something simple here, but I don't know just what that simple is :-)

I am trying to create a validation rule that won't allow specific parts to be ordered when a specific drop down box field is chosen on a part order.  Part Orders are cases, while the individual parts are custom objects.

Here is the rule I have in place:

AND
(BEGINS( $RecordType.Name , "Part/Supply Order"),
ISPICKVAL(Order_Type__c, "Parts"), OR(
(Part_1__c = "09-5000 (Lids, Case (1000)" ),
(Part_1__c = "09-1100 (Straws, 300 Count Package)" ),
(Part_1__c = "09-5200 (Spoons, 1000/Case)" ),
(Part_1__c = "09-1406 (Test Kit, Sanitizer)" ),
(Part_1__c = "09-1410-A (Sanitizer Kit, Standard)" )))

 

The goal is to have an error displayed when a Party/Supply Order case record type is saved, the value "Parts" is selected in the drop down field "Order Type" and then one of the listed parts is put in the Part 1 field.  The "Part 1" field is a lookup field for the parts custom object.

Any thoughts?

It seemed so easy and straighforward, but it apparently isn't!

Thanks!

Mike


Best Answer chosen by Admin (Salesforce Developers) 
nylonnylon

Hi,

If you see "Part 1 >" below "Part 1" in the Insert Field selection window, give it a try.

 

This article would be a help:

http://wiki.developerforce.com/index.php/An_Introduction_to_Formulas

 

All Answers

nylonnylon

Hi Mike,

As "Part 1" is a custom object lookup, Part_1__c in the code is just a Salesforce ID type field.

So you should use Part_1__r.Name or something instead.

It would be pretty easy by using "Insert Field" button above formula coding area.

nylonnylon

Also, If the correct record type name is "Party/Supply Order", you need to correct the code though I guess it's a typo.

msglsmomsglsmo

Good Morning!

 

Thank you for the assistance.  I'm not sure what you mean, though.

 

"Part_1__c" is the actual field name of the lookup field.  I did use "Insert Field" button to paste it into my formula.

 

Thank you again!

nylonnylon

Hi,

If you see "Part 1 >" below "Part 1" in the Insert Field selection window, give it a try.

 

This article would be a help:

http://wiki.developerforce.com/index.php/An_Introduction_to_Formulas

 

This was selected as the best answer
msglsmomsglsmo

Thank you, thank you, thank you!!!!!

 

That worked like a charm!