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
Mateo AlcauterMateo Alcauter 

Validate related list to not allow two specific record types.

Under accounts, we have a custom related list called "related parties"
Related parties can be different types (Beneficiary, Guardian, Interested Party, LPOA)
I want to make a rule so that the same person cannot be both an interested party an LPOA. 
Example: Under Alex's account, Rebecca is a related party of type "Interested Party", if someone else tries to add Rebecca as an "LPOA" under Alex's account, they should not be allowed since she is already an "Interested Party".
The other types don't matter. We just dont want to allow someone to be both Interested Party and LPOA under the same account. 

I was thinking of doing a VLOOKUP, but this does not work.
VLOOKUP($ObjectType.Related_Party__c.Fields.Name , $ObjectType.Related_Party__c.Fields.Name , Party_Type__c ) = "Interested Party" && VLOOKUP($ObjectType.Related_Party__c.Fields.Name , $ObjectType.Related_Party__c.Fields.Name , Party_Type__c ) = "LPOA" 
 
Best Answer chosen by Mateo Alcauter
Gaurish Gopal GoelGaurish Gopal Goel
Hi Mateo,

It can be achieved using an Apex Trigger on Related Parties custom object. Only then you will be able to control this. 

If this answer solves your problem then mark it as the solution to help others. Thanks.