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
Rajeev SatapathyRajeev Satapathy 

Want to insert list of products from Opportunity to a custom object

I want to insert list of products present on the opportunity to a custom object . Any suggestions/code snipets
MagulanDuraipandianMagulanDuraipandian
The object name of Opportunit Product is OpportunityLineItem.
So, Fetch tose records byu filtering by opportunity id and then insert with new opportunity Id.

If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)

Regards,
Magulan
http://www.infallibletechie.com
Rajeev SatapathyRajeev Satapathy

Written a trigger ....  wanted to insert a new salesorder record when quote status changes to 'Approved' .. this code is not working

--------------------------------------------------------------------------------------------------------------------
trigger Create on Quote (before update) {

List <SCRB_SalesOrder__c> SOlist =  new List<SCRB_SalesOrder__c>();

For(Quote Q : trigger.new)
{
   if(Q.Status == 'Approved')
   {
   SCRB_SalesOrder__c SO = new SCRB_SalesOrder__c();
   SO.OpportunityId__c = Q.Opportunity.ID; // Data not getting populated
   SO.Amount__c = Q.Opportunity.Amount ; // Data not getting populated
   SO.StatusCode__c =  'Billed';
   SOlist.add(SO);
   }
}
insert SOlist;

}
----------------------------------------------------------------------------------------------------------------------------------