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
GMASJGMASJ 

Out of list of contacts associated to account need to make one contact as primary validation

Hi, 

  I need to create a validation rule in contact where user can select one contact as primary associated to an account please suggest me how to add this validation please suggest me a best method to incorporate this rule. 

Thanks
Sudhir
Rajesh3699Rajesh3699
Hello Sudhir,

Hope the below ans helps.

1. Create a new checkbox field on account as : Primary Contact Exist ?
2. Once you create a new contact, and if you are making the contact as primary, fire the prcess builder to update the above field on account marked as true,
3. Create a validation on contact, to check if the account's Primary Contact Exist is tru or false.

Note: You need to handle a scenario where the primary contact is deleted from the system, make sure you uncheck the Primay Contact Exist field on respective account. [ manually or trigger]

Thank You,
Rajesh Adiga P.
GMASJGMASJ
Thanks Rajesh for you suggestion. I need one more suggestion what if user has to make different contact as primary on the same account how will this be handled. 

Thanks
Sudhir
Rajesh3699Rajesh3699
If all the contacts are editable for the user, irrespective of ownership, user has to initially update the primary contact from Primary to Secondary, where inturn the same process builder will fire [ On change of Primary to any other value] and unchecks the accounts, Primay Contact Exist ? to false.

So, now on account there is no primary contact, and hence user can create a new contact / or update existing and mark this as primary. 

The same procedure can be followed before deleting the primary contact, that is make the primary conatct  as secondary. [ so that at account level field update happends] after save successfully then user can delete the contact.

Thank You,
Rajesh Adiga P.