Find your content:

Search form

You are here

Opportunty field update from Opportunitypartner


I have a requirement to update the Lookup field on the Opportunity with the Account from OpportunityPartner.

As OpportunityPartner is read only object ,i am facing lot of challenges .

let me know if there is any way to do it

Attribution to: Keepcalmncode

Possible Suggestion/Solution #1

Write a trigger on the after update of opportunity Check whether this field has changed its value =PartnerAccount

trigger PopulatePartnerOnAccountFromList on Opportunity (after update) {

for (Opportunity o : {

i(o.parneraccount!= trigger.oldmap.get(

   OpportunityPartner[] PartnerArray =
   [select AccountToID, IsPrimary from OpportunityPartner where OpportunityId = ORDER BY isPrimary DESC, CreatedDate];
   if (PartnerArray.size() > 0) {

       o.Description = PartnerArray[0].AccountToID;


       o.Description = null;

} }

Attribution to: ram r

Possible Suggestion/Solution #2


this is not possible without the use of an Apex Trigger ( see topic here) as lookup fields cannot be updated via Workflow.

You will need to write some custom apex code in order to be able to perform this.


The best solution for this will be to use scheduled apex as you are unable to run workflow on the object as desired and there is not the ability to create triggers on the object or to have a roll-up summary on partners for you to use.

You could create a trigger on opportunity and see if you have any updated information? This will only run when the opportunity is updated however and so is unlikely to provide the coverage you need. Therefore I would suggest writing a scheduled class to implement the functionality you want.


Attribution to: pbattisson
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content