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
Cheriah200Cheriah200 

Editing visualforce PDF to resemble existing company Quote template

Hi,

 

I've been advised this is the best place to post this...

 

I've installed Quote Line Items (Version 0.7) from Appexchange and want to edit the page "Quote PDF" so that it looks similar to our existing quote template as we're looking to run our quote process through Salesforce.com.  The application is great and I've been given the go ahead to roll it out to everyone as long as the quote PDF can look more like our original version.  This is where I'm falling down - I've managed to add our logo to the template instead of the standard Visualforce one but can't get my head around adding a table and some standard text to the template. I know it's only a simple template and if it was HTML I'd be able to do it but I just can't figure out Visualforce.

 

Can anybody help with this at all please?  E.g. does anyone have a standard table I can copy & paste and then edit?  If I identify which fields need to be included, could someone guide me through how to enter them in to the table?  Is there a way of adding a standard header & footer to the page?

 

Thanks,

Cherie

Best Answer chosen by Admin (Salesforce Developers) 
RyanhRyanh

We just finished a project doing something very similar. The EditQuoteLines page is using the standard apex pageBlockSection tags and such. These tags just make it easy to replicate the standard Salesforce look and feel. You're completely entitled to get rid of those and enter in your own standard XHTML (XHTML - it needs to play nicely with XML). Where you want to include the fields from your Salesforce objects, you'd just include a tag like:

 

<apex:outputText value="{!item.Unit_Price__c}" />

 

That tag will output the value of that field -- if you want to have an interactive form, you'll simply use the existing tag like <apex:inputField value="{!item.Unit_Price__c}" />

 

Hope that helps.

All Answers

RyanhRyanh

We just finished a project doing something very similar. The EditQuoteLines page is using the standard apex pageBlockSection tags and such. These tags just make it easy to replicate the standard Salesforce look and feel. You're completely entitled to get rid of those and enter in your own standard XHTML (XHTML - it needs to play nicely with XML). Where you want to include the fields from your Salesforce objects, you'd just include a tag like:

 

<apex:outputText value="{!item.Unit_Price__c}" />

 

That tag will output the value of that field -- if you want to have an interactive form, you'll simply use the existing tag like <apex:inputField value="{!item.Unit_Price__c}" />

 

Hope that helps.

This was selected as the best answer
shan876shan876

Email me I just finished this project for a client of mine and can assist you...

strictlyit@yahoo.com

Thanks

Cheriah200Cheriah200

Thank you very much Ryanh!

 

I've written our page in XHTML as suggested, added the apex tags in the areas of the page and tables where needed and it works perfectly!

 

 

Cheriah200Cheriah200

Hi,

I just have another quick question regarding Quote Line Items - Dioes anyone know the maximum size for the Quote_PDF file?  I've edited it to be 105kb and it's now not working despite all the coding being correct.  Is there a limit of 1MB on the template?

Thanks

SesameSesame
I've been working on editing the visualforce code so that the layout works for our company.  The Simple Quote App includes <td>{!line.Description}</td> which is the line description on the line item.  What I'd prefer to use instead of the line description is the Product Description (standard sf.com field in Products). Anyone know what the code would be for me to do that?  
ClaiborneClaiborne
The product description would be line.product.description, but this data is probably not available unless you add an extension to the standard controller that queries for line.product.description.
SesameSesame

Thanks Clairborne,

 

Yes I did try that so you are right I must have to add an ext to the standard controller.  I'm not sure I know how to do that.  Any assistance would be greatly appreciate.

 

Thanks,

 

Rachel

Cheriah200Cheriah200

Hi,

 

In an apex datatable or panelgrid the reference for the standard product description field is  {!line.product2__r.description} I didn't have to change anything anywhere else. 

 

Hope this helps :)

 

Cherie

SesameSesame

Thanks!  I'm new to visualforce, so am still trying to figure this one out.  Here is the code I'm using to generate the quote.  The line in green below is the one I want to replace with {!line.product2__r.description}, but  I'm realizing it's not that simple.  Let me know if you can help.  Thanks!!

 

__________________________________________________________________________________

 

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">

 

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">

<tr>

    <td>

        <img src='{!URLFOR($Resource.Logo)}' title="logo" />
   

</tr>


<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>    <td><font face="Arial" >
        Sesame Communications<br/>
        15 South Grady Way Ste 420<br/>
        Seattle, WA, 98057<br/>
        <a>www.sesamecommunications.com</a><br/>
        </font></td>
        <td width="45%">&nbsp;</td>
   <td >
        Pricing valid through:&nbsp;<apex:OutputField value="{!Opportunity.CloseDate}"/><br/>   
        Proposed by: {!Opportunity.Owner.FirstName} {!Opportunity.Owner.LastName}</font>
     </td>
</tr>
</table>
<br/>
<hr/>
<table border="0" width="100%" id="table2">
<tr>
       <td colspan="3">
          <b><font face="Arial">Practice Information:</b><br/>  
                             {!Opportunity.Account.Name}<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                             {!Opportunity.Account.BillingPostalCode} {!Opportunity.Account.BillingCity}
           </font>
        </td>
</tr>   
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Services Recommended</font></b></p>
<table border="0" width="100%" id="table3">
<tr>
       <td bgcolor="#C0C0C0"><font face="Arial">Sesame Services</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Description</font></td>
        <td bgcolor="#C0C0C0"><font face="Arial">Price</font></td>
</tr>
<tr>
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td>{!line.PricebookEntry.Name}</td> 
              <td><apex:OutputField value="{!line.Description}"/></td>    
             <td><apex:OutputField value="{!line.UnitPrice}"/></td>

          </tr>
       </apex:repeat> 
</tr>
<tr>
       <td bgcolor="#C0C0C0" align="right" colspan="6">
</tr>
<p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p>
</apex:page>

Cheriah200Cheriah200

 Ok, I can try to help!

What happens when you change the line to the following?

 

 

<td><apex:smileysurprised:utputField value="{!line.product2__r.description}"/>   

 

SesameSesame

It says, Error: Invalid field product2__r for SObject OpportunityLineItem. 

 

Also, I went to email the pdf and the attachment is different from t he visualforce page I've setup.  Is there a different place you have to go to edit the code for an attachment?  I see where you go to edit the email template, but not the attachment.

 

I'm grateful!

Cheriah200Cheriah200

 I don't know how to put the text below in a box but this is part of my page with the info in a data table.  My standard controller is the quote line item application whereas yours is opportunity.  As you're referencing opportunity I believe that this is the reason why you can't show the product description - it's only looking at the opportunity section.  ( I may be wrong with this as I've only been using it a short while & it's all self taught but from my understanding this could be the reason why it's not working.)

Also, note the datatable value  is referencing quote lines <apex:dataTable value="{!SFDC_520_Quote__c.quote_lines__r}"  - {!line.product2__r.description} is referring back to this and I can only get it to work within the table.

 

I hope this helps.  Like I said, i've only been using it a short time too and I might be wrong but that is my understanding of it.

 

 

 

 

<apex:page standardController="SFDC_520_Quote__c" showHeader="false" renderAs="pdf" extensions="salesQuotes" >
    <body>
        <apex:stylesheet value="{!URLFOR($Resource.pdfresource, 'styles.css')}"/>


              
                    <apex:outputPanel layout="block" styleClass="lineSmall"/> 
                  
<apex:dataTable value="{!SFDC_520_Quote__c.quote_lines__r}" var="line" border="1" cellspacing="0" cellpadding="2" width="100%">
<apex:column headerValue="Quantity">
{!line.Qty_Ordered__c}
</apex:column>
<apex:column headerValue="Description">
{!line.product2__r.description}
</apex:column>
<apex:column headerValue="Product Name">
{!line.product2__r.name}
</apex:column>
<apex:column headerValue="Unit Cost">
{!line.Unit_Net_Price__c}
</apex:column>
<apex:column headerValue="Total Cost">
<apex:outputField value="{!line.Ext_Net_Price__c}"/> 
</apex:column>
</apex:dataTable> 
               

     </body>
</apex:page>

 

 

kdanikdani

I've just installed Simple Quote v1.0 and it looks good, managed to change the logo but I'm not able to remove fields from the VisualForce PDF it creates. I have tried removing the lines that relate to them from the visualforce code but they still seem to appear.

 

Can anyone help with this?

 

K

Cheriah200Cheriah200

Hi,

 

If you've removed the lines and taken out the field references then the information won't appear in your PDF.

 

If you want to, copy & paste your page here & I'll see if there's anything I can help with.

 

Thanks.

 

 

kdanikdani

Thanks for the offer of help. Looks as though I needed to log out and back in for the changes to be recognised. Loggged in this morning and the labels I removed are no longer there.

 

I'm going to set about modifying the template to make it more relevant to our company now

RioReyEdRioReyEd

I would also like to receive some assistance in customizing our quoting process and I certainly don't mind paying for it.  If there is anyone out there that could help us by taking our current invoice and creating a quote using the same basic information please contact me.

 

 

RioReyEdRioReyEd

So what the heck is wrong with this line?  I've changed the actual link. 

 

 

 <apex:stylesheet value="{!URLFOR($Resource.pdfresource, 'styles.css')}"/>

        <apex:image value="{!URLFOR('http://www.rioreysandbox.com/salesforce/', 'tinylogo.gif')}"/>

<apex:panelGrid columns="1" styleClass="companyTable" width="100%">

Chow5Chow5

Help...This is  fantastic infomation from all.  Has anyone figured out how to save the pdf to the quote section of the opportunity after it is created?  I've created a pdf quote using this information, but now can't save it back to SFDC without saving it to desktop and uploading it...not acceptable in my company.

 

Do I need to create an Apex Class???  Any example would be helpful.

 

 

Thanks a MILLION.

ClaiborneClaiborne

If you create an apex class, you can generate the pdf, but then save it as an attachment to the quote or opportunity record.

 

This code creates the pdf, but stores the result as a blob.

 

            // Generate the Order Confirmation as a pdf email attachment
            // Retrieve the PDF as a Blob from the Visualforce page     
        PageReference confirmation = Page.OrderConfirmation;
        confirmation.getParameters().put('oid', order.id);
        Blob pdf = confirmation.getContent();
This codewill save the blob as an attachment.

 

                       // Save pdf file as an attachment 
                   Attachment a = new Attachment(
                       parentId= OpportunityId, 
                       name= 'New Quote Name', 
                       body= pdf);
                   insert a;
These are snippets from a couple of modules, but they should do what you want.
Santos edgard marquinaSantos edgard marquina
Gracias por la información interna poner una tabla en HTML en  OctoStream (https://wiseplaylistasiptv.com/octostream-apk/) para ver su crecimiento. 
N Kumar 6N Kumar 6
All information is useful for me. I have learnt a lot
Naresh
morningpeace (https://morningpeace.com/)
Kim Young HwanKim Young Hwan
Hello,

Also take a look at the api version of the vf page.

Thanks.