0

My requirement is to update the name of the primary partner on a custom field (lookup to account) on opportunities object.

I tried to create a trigger on partner object but saw that it was not supported. I also tried a combination of process builder and flow to update but that was going to infinite loop as I was triggering it on update or insert ( silly me )

Doing a trigger on opportunity might not be efficient I think

Do you have any suggestions on how this scenario can be handled.

Regards

  • this is similar to dealing with CRUD on OpportunityContactRole – cropredy Aug 5 '16 at 4:52
  • Hi @cropredy , what do you think about creating a custom object similar to the partner object, that way we will be more options. Not sure if there are any cons that I will overlooking. – Bob Gali Aug 8 '16 at 4:10
  • Not that I can think of. You'll need to create new custom report types to replace the OOB ones – cropredy Aug 8 '16 at 4:42
  • Thanks @cropredy , I ended up creating a custom object and using process builder and flow on top of it – Bob Gali Aug 9 '16 at 2:15
2

This is similar to dealing with CRUD on OpportunityContactRole, a junction record between Contact and Opportunity where if changed, no trigger can be attached to the CRUD event on the junction record.

The OCR options are discussed here and summarized below (changing the references to Partner)

Four workarounds

  1. Run a scheduled batch apex job that sweeps the Opportunities (or Account) and looks at their Partners to perform the CRUD on Opportunity to update your custom lookup field. If not too many Accounts or Opportunities, job could run every 30 minutes or so.
  2. If you really don't need the field for reporting or other logic, but merely need to display the related Account - use an inline VF page within the Opportunity standard page layout to show fields from the partner Account.
  3. Use the 'On View' Opportunity trigger as described here in Soliant's blog. This defers the update of the lookup field on Opportunity until the Opportunity page is actually viewed (of course, if never viewed, then never updated)
  4. Redo the Account and Opportunity page to use a custom button to make changes to the Partner junction record. This custom button is backed by a VF page/controller

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.