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

Apex Trigger help!
Hello,
I want to create a simple trigger which automatically inserts products after an opportunity is first created.
I have gotten as far as:
trigger ProductAddTrigger on Opportunity (after insert) {
}
What is the syntax to add opportunity products?
You need to insert OpportunityLineItem sObjects. Here is a link to the API docs which details each standard object.
You can also use the Schema Explorer that comes with the Force.com IDE to see all the fields on a given sObject.
All Answers
You need to insert OpportunityLineItem sObjects. Here is a link to the API docs which details each standard object.
You can also use the Schema Explorer that comes with the Force.com IDE to see all the fields on a given sObject.