You need to sign in to do that
Don't have an account?
Alex Reading
Quote Line items from Opportunity Line Items
Hello All,
I currently have an APEX trigger which (when an opportunity has a QUOTE and is closed won), creates a second quote (which will be used as an invoice)
I was wondering if anyone can help me with possibly editing this code to also pull the Opportunity Line Items and add a quote line item for each one in the new automatically generated quote?
For example, If I have the Opportunity Line Item "Dog" from the "Animals" Pricebook at "$100" how can I change the code to not only automatically create the quote but also add a Quote Line Item for a $100 Dog?
Here is my code:
Any help you can provide would be great!
Thank you!
I currently have an APEX trigger which (when an opportunity has a QUOTE and is closed won), creates a second quote (which will be used as an invoice)
I was wondering if anyone can help me with possibly editing this code to also pull the Opportunity Line Items and add a quote line item for each one in the new automatically generated quote?
For example, If I have the Opportunity Line Item "Dog" from the "Animals" Pricebook at "$100" how can I change the code to not only automatically create the quote but also add a Quote Line Item for a $100 Dog?
Here is my code:
trigger InvoicefromQuote on Opportunity (after insert, after update) { Map<Quote, Id> quoteMap = new Map<Quote, Id>(); for (Opportunity o : Trigger.new) { if(o.isWon == true && o.HasQuote__c == true ){ Quote q = new Quote(); q.name = 'Quote-' + o.name; q.opportunityId = o.id; insert q; quoteMap.put(q, o.accountId); } } }
Any help you can provide would be great!
Thank you!
https://developer.salesforce.com/forums?id=906F00000008llQIAQ
http://salesforce.stackexchange.com/questions/24209/trigger-to-add-products-to-opportunity-line-item-from-a-custom-object-without-pr
http://raydehler.com/cloud/clod/clone-a-quote-line-item-with-an-apex-controller.html