You need to sign in to do that
Don't have an account?
cl0s3r
Opportunity line item relationship
I need some assistance making a connection. I would like to create a custom vf page to create the line items of an Opportunity. I follow the standard process and I see the lineitem.jsp page which I want to replace with a custom page, but don't understand the relationship to perform operation.
You should review the Opportunity Line Item ER Diagram here:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_products.htm
Basically, you can use a standard controller of Opportuinty, and create an extensions for your custom VF Page.
Inside the Extension, build a query so that you grabe the objects in the ER Diagram.
if any body know the solution plz post..
Here's some code that will lay it out correctly:
Account a = new Account();
a.name = 'test Account';
insert a;
Pricebook2 pb = [SELECT Id, IsActive FROM PriceBook2 WHERE IsStandard=True];
p2.name = 'test p2';
insert p2;
pbe.Pricebook2Id = pb.id;
pbe.Product2Id = p2.id;
pbe.IsActive = true;
insert pbe;
o.AccountId = a.Id;
o.Name = 'test';
o.StageName = 'Prospecting';
o.CloseDate = date.today();
insert o;
OpportunityLineItem ol = new OpportunityLineItem();
ol.OpportunityId = o.Id;
ol.Quantity = 1;
ol.UnitPrice = 2.00;
ol.PricebookEntryId = pbe.Id;
ol.Converted_to_Asset__c = false;
ol.Description = 'testing testing';
insert ol;
This is just a test class that lays everything out the way it needs to to successfully perform the insert and association of Opportunity Line Items.
Thanks!
Brad