You need to sign in to do that
Don't have an account?

Apex trigger to attach products to opportunities based on opportunity record types
Hi Gurus,
One new requirement, We need to attach products to opportunities based on opportunity record types. Is this possible through Apex triggers?
Please help
Thanks,
Yamini
One new requirement, We need to attach products to opportunities based on opportunity record types. Is this possible through Apex triggers?
Please help
Thanks,
Yamini
You need to use following Object in your trigger
Product2
Pricebook2
Pricebookentry
Opportunity line Item (for Insert)
Keep in mind opportunity line item not support more than 1 price book in same opportunity.
~Thanks
Onkar Kumar
hs1 What if I had long list of products codes. can i get them with a SOQL Query?
Hi hs1,
I am a new bie
can you please provide full code for this, I did not see opportunity record type checking anywhere in the code.
thanks,
Hi Bathy,
Can you let me know your exact requiement, i.e., are you trying to add different products, based on different record-types ?
Can you give an example, with record-type name and products, so that I can tweak this code for you ?
Yes my requirement is to add the products based on the record type. We currenlty have 9 record types for opportunities. And the products must be added based on each record type.
You can edit the recordtypeID_1,2,3 as per your needs, and also update code1,2,3 etc as per your needs.
If this doesn't work, paste your modified code, and i can help you in finding out why it is not working
We have a custom field in the Request object, that field contains an ISBN, is it possible to create a trigger that would look at that field, search our products for that ISBN and then add it to the opportunity as a product?
This would be amazingly helpful.
Thankyou in Advance