function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kcpluspluskcplusplus 

Quote Template

I'm trying to get into making some customizations with VF for the first time, so I may be missing something right off the bat. 

 

What I'm trying to do is replace the existing quote pdf that is generated. Specifically what I need to change is the order of how the items appear on the quote line items related list of the template. I knew going in that because the template is a pdf and not a regular page layout, I would need to completely override the functionality and start from scratch. After doing a little research on this, I think the best way to do it is a custom button to direct to a visualforce page that renders as a pdf, which was a pretty cool thing I just learned that you can do with vf pages. From there it would be rebuilding the structure of the page from the ground up, which shouldn't be a problem and I think, using a custom controller to set the order of the related list.

 

So, I got in a dev org to start some really early playing around with this before starting to work on it in a sandbox. The first thing  I tried was rendering as a pdf which worked great, but then I tried displaying the relatedlist and that's where I ran into problems. 

 

This is the markup I was using to test and the error is 'QuoteLineItem' is not a valid child relationship name for entity Quote 

 

<apex:page standardController="Quote">
<apex:detail relatedList="true" subject="{!Quote.Id}" title="test">
<apex:relatedList list="QuoteLineItem" rendered="true"/>
</apex:detail>
</apex:page>

 

So, I couldn't find anywhere that said I couldn't use QuoteLineItems as a vf related list, but nowhere that said I could either. So I guess I have two questions, the first being obviously, can I reference the QuoteLineItem child relationship in Quote controller VF page, and if so, what am I doing wrong. 

 

The second, since I gave in and posted on here after hours of research, is whether or not I am going about this the right way. Is there an easier way to override the quote pdf with an end goal of reordering that related list?

 

Any help, tips, links to some good resources would be much appreciated. 

 

--KC

Best Answer chosen by Admin (Salesforce Developers) 
jd123jd123

these links will help you

 

 

SortOrder is in the system, despite not appearing in the Setup screen, or the Web Service's API Developer's Guide. It does appear in the WSDL under Develop > API, however. You can use it only if your API version is high enough (HINT: 16.0 is too low). Try changing your code's API to 23.0 or 24.0.

 

 

http://success.salesforce.com/questionDetail?qId=a1X30000000Hs10EAC

 

 

http://forums.sforce.com/t5/Apex-Code-Development/How-to-change-Quote-Line-Item-sort-order/td-p/327677#M58130

 


https://ap1.salesforce.com/help/doc/en/sorting_products_on_opportunities.htm

 

http://boards.developerforce.com/t5/Apex-Code-Development/How-to-change-Quote-Line-Item-sort-order/td-p/327677

All Answers

jd123jd123

Hi

 

try this code

 

<apex:page standardController="Quote">
<apex:detail relatedList="true" subject="{!Quote.Id}" title="test">
<apex:relatedList list="QuoteLineItems" rendered="true"/>
</apex:detail>
</apex:page>

kcpluspluskcplusplus

Okay cool that actually helped me quite a bit. I guess I have just one other question. Is there a way that I can use that to change the sort order to automatically sort by a custom field on the quote page, so that when I use that to generate a new quote pdf, it will automatically be sorted by the correct field. 

 

I know I can use the sort functionality to manually do this, but with 20-100 quote line items if I can find a way to auto sort, that would be really great. Thanks for your help!

 

--KC

jd123jd123

these links will help you

 

 

SortOrder is in the system, despite not appearing in the Setup screen, or the Web Service's API Developer's Guide. It does appear in the WSDL under Develop > API, however. You can use it only if your API version is high enough (HINT: 16.0 is too low). Try changing your code's API to 23.0 or 24.0.

 

 

http://success.salesforce.com/questionDetail?qId=a1X30000000Hs10EAC

 

 

http://forums.sforce.com/t5/Apex-Code-Development/How-to-change-Quote-Line-Item-sort-order/td-p/327677#M58130

 


https://ap1.salesforce.com/help/doc/en/sorting_products_on_opportunities.htm

 

http://boards.developerforce.com/t5/Apex-Code-Development/How-to-change-Quote-Line-Item-sort-order/td-p/327677

This was selected as the best answer
kcpluspluskcplusplus

That's a perfect solution, so much easier than reworking the entire page. Thank you so much. :]

 

--KC

jd123jd123

i am very happy to solve your question.