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
David Herrero 5David Herrero 5 

Account Contact Relationship API

I would like to validate if an account is in the Account Contact Relationship object. I can't find the Account Contact Relationship  API name.
As it is not possible to do it with the Lookup filter criteria, I 'd like to do in the trigger, but I am begining to think this is not possible neither.

Any tip with this issue?

Thanks
AjazAjaz
Hi David,

In the trigger, use the below SOQL to check whether the account is already related with a contact.

Integer count = [select count() from contact where accountid='1234567678990'];
if(count>0)
system.debug('This account already has a relationship with a contact');

Hope this solves your problem. Let me know the feedback. Dont forget to hit that thumbsup button if it solves your issue.

Regards,
Zaja.
David Herrero 5David Herrero 5
Hi Zaja, thanks for your response but this is not what I need.
I need to know if an account is in the Account Contact Relationship object (new object from the past year)
Now it is possible to include one contact in up to 800 accounts, and I want to check if one account is between the related accounts of a contact.

Thank you anyway