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
sudhIr NarayansudhIr Narayan 

Not able to update


Hi, 

 I am not able update opportunity SyncedQuoteId with quote Please suggest me some steps this is new method for me


trigger update_quote_id on Quote (after insert) {
 
 List <Quote> Qo= [ select id,opportunityid from quote where id = :Trigger.newMap.keySet()];
 
 for ( Quote Qt : Qo)
  {
   
     if ( Qt.opportunityid <> null ) 
     {
     
    list <opportunity> op = [select id,SyncedQuoteId from opportunity where id = :Qt.opportunityid];  
      
     
     for ( opportunity opp: op )
      {
       
       opp.SyncedQuoteId = Qt.id;              
       
       update opp;
      }
       
   
     }
  }
  
}


Thanks

Sudhir

ShashankShashank (Salesforce Developers) 
Hi Sudhir,

The SyncedQuoteId field cannot eb updated in a trigger. You have to instead do it in an apex class and call that apex class in the trigger. Please see this: http://blog.softwareallies.com/2010/08/salesfoce-syncing-quote-in-apex.html

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank