You need to sign in to do that
Don't have an account?
Andrew Likens
Click button to create opportunity line items on a custom object related list
Hello,
I'm looking to create a button that when clicked, will create an opportunity line item on a custom object related to the opportunity as a related list. Very similar to syncing opp line items and quote line items. My custom object is called "Product__c" and has fields Quantity, Description, Amount, etc., same as opp line items. The Product__c object is a child of "Virtual_Request__C" object that has a lookup to the opportunity. I want the Product__c fields to match the standard opp line item fields.
I'm unsure if a trigger is used here or apex code because I want the action to occur from a button click. Any help is greatly appreciated!
I'm looking to create a button that when clicked, will create an opportunity line item on a custom object related to the opportunity as a related list. Very similar to syncing opp line items and quote line items. My custom object is called "Product__c" and has fields Quantity, Description, Amount, etc., same as opp line items. The Product__c object is a child of "Virtual_Request__C" object that has a lookup to the opportunity. I want the Product__c fields to match the standard opp line item fields.
I'm unsure if a trigger is used here or apex code because I want the action to occur from a button click. Any help is greatly appreciated!
Trigger fires on a DML operations (Insert, update, delete etc.). If you need this to fire via button, Batch class can be called from a button.
OppLineItem.Amount = Product__c.Amount
OppLineItem.Quantity = Product__c.Quantity
OppLineItem.Description = Product__c.Description
And so on.....
Hope this provides clarification.
Batch Class:
After you create/save this Batch Class, you should create a Javascript - Detail Page Button on your "Virtual_Request__C" object. ** Do not forget to add button on the layout after it is created.
Button:
Hope this helps.
-Saurabh
Compile Error: Argument type of global method must also be global: List<Opportunity> at line 8 column 20
Error: Compile Error: Variable does not exist: ID at line 15 column 29