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

How do I write a trigger that would automatically create an order whenever a quote get accepted? Thanks Neeraja

salesforce mesalesforce me
Hi Neeraja check it once...
trigger test1 on Order__c (after insert)



Quote q=[select id from Quote where id=:to.Quote__c];

QuoteLineItem ql=[select id,...,....,.. from QuoteLineItem where];


for(QuoteLineItem qli:ql)


OrderLineItem__c lm=new OrderLineItem__c();





insert lm;


salesforce mesalesforce me
check this one also...
trigger qlitem on QuoteLineItem (after insert, after update) {
        List<opportunity> opl=new List<opportunity>();
        public static double total=0;
        List<quotelineitem> qlil=new List<quotelineitem>();
        Quote Q=new Quote();
        Opportunity opp=new Opportunity();
        Q= [Select id,opportunityid ,grandtotal,totalprice,primary__c from quote where id=:qli.quoteid];
        opp=[Select id, amount from Opportunity where id=:q.opportunityid];
        for(integer i=0;i<qlil.size();i++){
                //This logic is used for updating the amount of opportunity  with quote total price
                Opp.amount=q.totalprice+total ;
            update opl;

Thank you so much. I will try and let you know. If I have any queries I will get back to you.