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
sanjusfdcsanjusfdc 

Display pick list value based on other object pick list value

Hello All,
I have 3 objects  A,B,C.
A(Account) and B(Address)  have master details relationship, For One parent we can created upto 5 types of child,Example Address1,Address2 ,Address3 ,Address4 ,Address5.
Object C(VR) and A(Account) have master detail relationship.
In Object C I have a picklist field with values Address1,Address2 ,Address3 ,Address4 ,Address5., 
So take an example I will create an Account with  2 addresses records,
that is Address1 and Address2, now I have to write a logic on object C trigger, if in the picklist values if any user select other than these two address. I have to display an error.
Help me on this.
Thanks in advance.
 
Ashish KumarAshish Kumar
Hi Sanju,

Why you want to write a trigger on Object C (VR).
What you can do is put a validation rule on Object c that for any Object C record , show error in case if picklist value is other than Address1 or Address2.

Please let me know if i get it right.

Regards,
Ashish Kr.
sanjusfdcsanjusfdc
Hi Ashish,

Yes you are correct I have to write  validation rule. Please let me know how i can write validation for this. Help me on this.
Ashish KumarAshish Kumar
Hi Sanju,

You may use the below formula in validation rules.
NOT(OR(ISPICKVAL(picklistApi__c,"Address 1"),ISPICKVAL(picklistApi__c,"Address 2")))

Please let me know if it helps.

Regards,
Ashish Kr.