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
Stephanie Boggs 17Stephanie Boggs 17 

Opportunity Contact Role Automation

Hello,

I am attempting 2 different types of automation for creating Opportunity Contact Roles (OCRs).
  1. Adding a contact with a certain level of activity as an Influencer.
    • I have custom fields on the contact that calculates the total activity and a simple checkbox that determines if the contact should be an OCR or not (if an Opportunity is open).
    • Adding only when meeting the criteria, not removing at all. Removal can be manual.
  2. Copying OCRs from a previous opportunity to a renewal opportunity. 
    • When an opportunity is closed won a renewal opportunity is created automatically. We would like the OCRs for the original opportunity to be copied over to the renewal. 
I have attempted to do this with Flows and Process Builder, but Process Builder is limited in regards to creating OCRs. I have reviewed the most popular OCR blogs, but they are mostly based on having a Contact lookup field on the Opportunity, and I don't want more than one lookup. Even if I somehow made the single lookup auto-update with a contact when it reaches the criteria I don't know how I would update the single field since the opportunity is not yet related to the contact (this might be easiest if you can tell me how to do this!).

I am a click-to-code admin (VF is not easy for me) so any help with APEX/Triggers would be AMAZING! Or at least possible brainstorming or simple triggers/code to assist with a flow/process builder.

THANK YOU!!!