+ Start a Discussion

How to add the Product details for opportunity using trigger

how to automatically added the products(opportunity lineitem) based on condtion.

in Opporutnity i created 2Fields i.e

                                                                1.ServiceType (Picklist datatype   Required)

                                                                2.ContractLengthmonth(Text datatype Required).


1.ServiceType picklist contain National,International,NotProvider values


i created some products in product object. like international service 01months , International Service 03months and International Service 06 month. each product contain pricebooks.


Now i fills the Opportunity information in opporutnity that time i select the International value from ServiceType picklist  and  i fills  the 3 in ContractLengthmonth Field. after i click on save button  then automatically added the Prodcut details  i.e  Internation Service 03months like this. 


samelike i select the International value from ServiceType picklist and i fills the 2 in ContractLengthmonth field after i click on save button then automatically  added the product details. i.e International Service 02months product name. how can create the trigger for this task please help me...............................


I am confused about one thing. Product details? Is that a field on Opportunity? 


thanks for your post Vishal.  No is  not a field in opportunity. i.e Product Standard object.