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

Adding OpportuntiyLine Items to a custom Object
Hello -
I am trying to add a visualforce page to my custom object that will show the related products.
So my "Sales Checklist" object is housed on the opportunity, sales fills all the information out then the object is sent to a queue.
But to save time i want to pull in the opportunityLineItems in to the sales checklist?
Is this possable? I know very little visualforce.
This is as far as I have gotten:
<apex:page StandardController="Sales_Checklist__c">
<apex:relatedList list="Opportunity__r" />
<apex:pageBlock title="{!Sales_Checklist__c.Opportunity__r.Name}"/>
<apex:dataTable value="{!Sales_Checklist__c.Opportunity__r}" var="opp" cellPadding="4" border="1">
<apex:column ><apex:facet name="header">Product Name</apex:facet></apex:column>
<apex:column><apex:facet name="header">Quantity</apex:facet></apex:column>
<apex:column ><apex:facet name="header">Unit Price</apex:facet></apex:column>
<apex:column ><apex:facet name="header">Total Price</apex:facet></apex:column>
</apex:dataTable>
</apex:page>
any help would be greatlt appriciated
Thanks,
Niki
This problem was already solved inthis post:
http://boards.developerforce.com/t5/Visualforce-Development/Aggregate-Relationship-is-used-in-an-unsupported-complex/m-p/275441
it involved creating 2 VF pages and loading 1 into the other through an iframe.
All Answers
There are a few ways to define columns in VF tables:
Heres one
another:
Thank you!
But i actully know how to add the columns, to the page i just cant get the "Products" (opportunityLineItems) to show up for the related opportunity
I need to show the Related products that where sold on the opportuntiy, I need the Name, Quantity, and Totalprice??
Here is my Code:
So your Sales_Checklist has a lookup to Opportunity and Opportunity has a related list of OpportunityLineItems.
The value for a table should be a collection/list/array of objects, not a single object (Opportunity), with the var being a shorthand pointer to an object in the collection. Perhaps it works for a single object - I've never tried.
So your table should really be for the OpportunityLineItems (not the Opportunity) so value should be like this (OpportunityLineItems is thte child relationship name)
also to make it less confusing you should change var to reflect that it is referencing an individual OpportunityLineItem.
Now your table columns can display the fields on an OpportunityLineItem e.g.
Colin Thank you so much for your help!
So i made the changes you noted: But now i get the following error?
Ok - i took out all the fields, and just built the shell and i still get this error:
Error: Aggregate Relationship is used in an unsupported complex expression containing 'opportunity__r.opportunitylineitems'
This problem was already solved inthis post:
http://boards.developerforce.com/t5/Visualforce-Development/Aggregate-Relationship-is-used-in-an-unsupported-complex/m-p/275441
it involved creating 2 VF pages and loading 1 into the other through an iframe.
Thank you SOOO MUCH!!! using the Iframe worked!
You helped me soo much!:smileyvery-happy:
Niki
I guess for the benefit of others reading this at some point in the future
Page 1
and a second page (OppLines)
I wouldn't call that a solution... more of a workaround really. I don't like it. Does anyone have a REAL solution and or explanation for this error?
Any one know how to get this to work in a vf email template???
Thanks
Eric
Hi,
Can anyone tell how perform same thing in PDF .bec <apex:iframe> is not working in pdf format...any help
thanks,
jaba
I was trying to create a pdf attachment to VF email template. The iframe approach does not work. I created a custom component that has Apex code (SOQL query) to get the child records.
Any chance you could share how you did this?
Im trying to get all the quote line items displayed on a custom object that has a lookup field to the orginial quote.
Basically , I am trying to create an invoice using a new object from the orignial quote showing the line item content.
But this is apparently not possible in professional edition as i am trying to cross two relationships !
Thanks