1

I have Salesforce integrated with HubSpot for my client and noticed some odd behavior going on with HubSpot smartlists with criteria for including Contacts who are associated with Opportunities via the Contact Role.

HubSpot (and Pardot) require a Contact to be associated with an Opp via the Contact Role if you want to use an Opp as criteria for including that Contact in a smart/dynamic list or action.

I had assumed that deleting a Contact from an Opp's Contact Role would sever the association between the Opp and the Contact. Then I noticed a few of these Contacts showing up in my HubSpot smartlists.

When I examined the Contact detail page I found the Opportunity still listed under the Opp related list. But when examining the Opp detail page, the Contact was still gone from the Contact Role list.

Has anyone had experience with this and is there a way via Apex to truly sever the connection between the Contact and Opp?

Thanks!

  • Hi Karl, take a look at OpportunityContactRole in the ObjectReference. It has a lot to say on the subject that I think you'll find helpful. – crmprogdev Jun 19 '15 at 20:23
  • Thanks. I had looked at it and anything else I could find via Google and the Salesforce Success community, but no luck. However, I think I figured out part of the answer. You can delete a Contact from the Contact Role list using the Del (delete) link, but the Contact remains in the editable Contact Roles list AND the Opp remains on the Contact's Opportunity related list. But this is where it gets weird. If you have more than one Contact on the Opp's Contact Role list and delete that Contact via the Contact Role edit dialog, then the Contact is no longer associated with the Opp. – Karl Barndt Jun 19 '15 at 22:39
  • (continued) Unfortunately, you can't delete a single Contact via the edit dialog. I'll keep digging. – Karl Barndt Jun 19 '15 at 22:45
0

The documentation for OpportunityContactRole.ContactId covers this to some degree:

ContactId

ID of an associated Contact. The API applies user access rights to the associated Opportunity for this object, but not to the associated Contact. The API may return rows from a query on this object that include this field’s values for contacts to which the user does not have sufficient access rights. It may also return values for this field for contacts that have been deleted. In either case, the client must perform a query on the contact table for this field’s value to determine whether the Contact is accessible to the user and has not been deleted.

In Apex you could use SOQL to hunt out and delete this extra records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.