1

I have two fields.

  1. Type (Dropdown ) --> Requisition_Type__c
  2. Site (Lookup) --> Site__c

When the user selects Type = "XYZ", I want Site field to have these 4 options A, B, C, D. I have located the object on which I want to create the validation rule but I am not able to understand how to write the formula.

  • can you clarify a bit around the site field/object/concept? – dacology Nov 5 '14 at 20:50
  • so when the user clicks on Type, a dropdown shows up. This dropdown has 2 options say: ABC, XYZ. Now, there is another field in that page named Site which is a lookup. Lets say, the user selects XYZ from the dropdpwn, and now when the user goes to the site field to select. When he clicks on the lookup, I want him to show only 4 options say A, B, C, & D coz he has chosen XYZ in the dropdown. – LazyBones Nov 5 '14 at 20:58
1

Assuming 'A,B,C,D' in site is Name field.

Try this

AND(  ISPICKVAL(  Requisition_Type__c, 'XYZ'), OR(  Site__r.Name= A ,Site__r.Name= B ,Site__r.Name= C ,Site__r.Name= D  ) )
| improve this answer | |
  • Just a little change according to what i want AND(ISPICKVAL(Requisition_Type__c, 'Materials'), IF(OR(CONTAINS(Site__r.Name,'A'),CONTAINS(Site__r.Name,'B'),CONTAINS(Site__r.Name,'C'),CONTAINS(Site__r.Name,'D')),false,true)) – LazyBones Nov 7 '14 at 14:46
1

You can not do this with a Validation rule, BUT you can do this with a Lookup Filter.

To set this up on a lookup filter you would need to have corresponding type fields on both objects; the source object and the lookup(site) object.

See my example below using the Contact object (the source) and my custom object Check (Site for you), where the contact type is set to "XYZ" the lookup only allows the selection of Check(Sites) where the site type is also "XYZ".

enter image description here

The filter criteria says, "Only allow the lookup selection of Checks (sites) where the Type field value on the Check(site) object is equal to the Type field value on the Contact object."

The lookup filter is configured on the source object lookup field (the site__c field).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.