+ Start a Discussion
ArjunmcaArjunmca 

Trigger to verify a contact is associated with Person Account

Our client using Person accounts. As you all know case object have lookup relation ship with Account and Contact.
While creating a case, if i select an account and then select a contact, i need to verify that the selected contact is associated with Account object or not.
If not associated i need to display a message. 

Can i write a trigger on case object to get the contacts associated with account  in to a map  and then verify the selected contact is in the map?
Does that work or is there special logic for person accounts?

Any suggestion or link appreciated. 
Thanks.
AshwaniAshwani
Logic is very simple you need to go to Account record from selected Contact and on Account record there is a field "isPerson" if it is checked to true then Account is a person account and all child contacts are part of it.