The goal of this article is to enable the implementation of the PDF template provided on GitHub.
Please read and follow this article carefully, as adhering to the API names is essential for saving the Visualforce Page.
To keep these prerequisites focused on the most relevant information, you will not find implementation procedures here, but rather links to Salesforce help or other articles in our knowledge base.
Template overview
Here are the features of this PDF invoice template.
This PDF template allows you to display the following options:
By checking the check box Show payment schedule on the invoice, the payment schedule will be displayed on the third page of the template.
By adding your GTCs as an image in static resources, you can easily set them up in this PDF template. |
In order to register the Visualforce page, you first need to set up these custom labels and the fields you've created that didn't yet exist in the Frisbii package.
These fields may become available in a future version of Frisbii.
Custom labels to create
Please set up these personalized labels and, if necessary, their translation.
Label lists
Short description | Categories | Value | Language | Translation text |
|---|---|---|---|---|
Sofacto_Address1 | Billing address | English | Billing address | |
Sofacto_Adresse2 | To the attention of : | English | C/O : | |
Sofacto_Address3 | Shipping address | English | Shipping address | |
Sofacto_IssueDate | Issued on | English | Issued on the | |
Sofacto_DeliveryDate | Delivery scheduled for | English | Shipping scheduled for | |
Sofacto_SchedulePayment | Payment schedule | English | Payment plan | |
Sofacto_ExclTaxLine | Excl. VAT | English | Before Tax | |
Sofacto_Indexes | Price revised according to the formula P1 = P0 x (S1 / S0) | English | Price recalculated according to this formula P1 = P0 x (S1/S0) | |
Sofacto_Milestone | Milestone | English | Proportion | |
Sofacto_OrderNumber | Order number : | English | Order Number: | |
Sofacto_UnitPrice | P.U.H.T. | English | Unit Price | |
Sofacto_NextPage | See next page... | English | See next page... | |
Sofacto_Proforma | Proforma | English | Proforma | |
Sofacto_Quantity | QTY | English | QTY | |
Sofacto_RaisonRemise | Reason | English | Discount Description | |
Sofacto_Discount | Discount | English | Discount | |
Sofacto_BottomDiscount | Footer discount | English | Discount applied after all other adjustments | |
Sofacto_VATrate | VAT | English | VAT Rate | |
Sofacto_IncludingTax | NET A PAYER TTC | English | DUE BALANCE | |
Sofacto_VAT | VAT | English | VAT | |
Sofacto_VAT2 | VAT breakdown | English | VAT Distribution | |
Sofacto_VAT3 | Excl. VAT | English | Amount before Tax | |
Sofacto_VAT4 | VAT amount | English | VAT Amount |
Here are some articles that explain how to apply labels:
Please note:
Writing the Short Description is important because if the names don't match, you can't save the Visualforce page.
All other values in this table are suggestions that you can personalize and adapt to your needs.
Fields to be created
To set up the following fields, please follow this Salesforce procedure: Creating custom fields.
Field lists
Subject | Field type | Field label | Field name | Details | Filter criteria | Decimals |
|---|---|---|---|---|---|---|
Invoice | Check box | Show discount amount | Show_discount_amount | ./. | ./. | ./. |
Invoice | Check box | View Payment Schedule | Display_Payment_Schedule__c | ./. |
|
|
Invoice | Cumulation summary | Total 10% VAT | TotalVAT10 | Invoice line: VAT amount | VAT rate EQUAL TO 10 | ./. |
Invoice | Cumulation summary | Total 20% VAT | TotalVAT20 | Invoice line: VAT amount | VAT rate EQUAL TO 20 | ./. |
Invoice | Accumulation summary | Total 5.5% VAT | TotalVAT55 | Invoice line: VAT amount | VAT (%) CONTAINS 5 | ./. |
Prerequisites | Formula (Currency) | Amount excl. VAT | Montant_HT | sofactoapp__Montant__c /( 1+ TVA__c) | ./. | 2 |
Prerequisites | Formula (Currency) | VAT amount | Montant_TVA | sofactoapp__Facture__r.sofactoapp__TVA_pc__c | ./. | 2 |
This Trailhead unit is also available: Creating custom fields.
Please note: Please fill in this information carefully. Writing Field Names is very important, as you can't save the Visualforce page if Salesforce doesn't recognize the API field names.
Note: Don't forget to display the Show Payment Schedule and Show Discount Amount checkboxes on the invoice page layout, ideally in the Invoice Layout section.
How to set up terms and conditions
Note: If you don't want to set up the GTC's, you have two options:
1) Add the static resource anyway, but without the file.
2) Remove the code from the Visualforce page.
If you don't follow one of these two options, you won't be able to save the Visualforce page.
The code that displays the terms and conditions is at the very bottom of the Visualforce page:
<!--CGV/ Terms and Conditions-->
<div style="page-break-before:always;">
<apex:image value="{!URLFOR($Resource.CGV)}" style="left:0;top:0;width:98%"/>
</div>
<!--Fin code CGV/ End of terms and conditions-->If you don't want to use the GTCs in the invoice, you can delete this part of the code.
Warning/ Important : If you delete more code than this part, you can no longer save the page.
Add image to static resources
If you'd like to place the GTCs on the invoice, please add an image of your GTCs in the static resources. Save this resource as:
Sofacto_CGV.
Please note Spelling must be respected.
Here is the Salesforce procedure : Viewing and modifying static resources.
T&Cs image tip :
Leave as little margin as possible.
Make sure the font size is always legible.
Cut your GTCs into several pages.
Note: Once you've set up the Visualforce page, you'll need to test it to see if it makes additional page breaks.
In this case, you need to display less information per image.
If you want to add several pages of GTCs, you can just repeat the line :
<apex:image value="{!URLFOR($Resource.Sofacto_CGV)}" style="left:0;top:0;width:98%"/>and modify the names of static resources :
<!--CGV/ Terms and Conditions-->
<div style="page-break-before:always;">
<apex:image value="{!URLFOR($Resource.Sofacto_CGV1)}" style="left:0;top:0;width:98%"/>
<apex:image value="{!URLFOR($Resource.Sofacto_CGV2)}" style="left:0;top:0;width:98%"/>
</div>
<!--Fin code CGV/ End of terms and conditions-->GTC in English
If you want to add your Terms & Conditions (the English version of your CGVs), you can also put them on static resources, like the French version.
Please note: This code includes two GTC pages per language, which are named :
Version FR:
Sofacto_CGV1
Sofacto_CGV2
EN version:
Sofacto_CGV_EN1
Sofacto_CGV_EN2
If you want to name them differently, or just have one page per language, please modify the code accordingly.
Next, add this code:
<!--CGV/ Terms and Conditions-->
<div style="page-break-before:always;">
<!--Version FR/ French Version-->
<apex:outputPanel rendered="{!IF(sofactoapp__Factures_Client__c.sofactoapp__Langue__c = 'en_FR', '', 'none')}">
<apex:image value="{!URLFOR($Resource.Sofacto_CGV1)}" style="left:0;top:0;width:98%"/>
<apex:image value="{!URLFOR($Resource.Sofacto_CGV2)}" style="left:0;top:0;width:98%"/>
</apex:outputPanel>
<!--Version EN/ English Version-->
<apex:outputPanel rendered="{!IF(sofactoapp__Factures_Client__c.sofactoapp__Langue__c = 'en_FR', 'none', '')}">
<apex:image value="{!URLFOR($Resource.Sofacto_CGV_EN1)}" style="left:0;top:0;width:98%"/>
<apex:image value="{!URLFOR($Resource.Sofacto_CGV_EN2)}" style="left:0;top:0;width:98%"/>
</apex:outputPanel>
</div>
<!--Fin code CGV/ End of terms and conditions-->Warning: The name given in the Visualforce page must match the name of the static resource. Otherwise, the page cannot be saved.
Note: You can add as many pages as you like. Test the result carefully, especially when printing, to ensure good quality and legibility.
English translation
Thanks to the labels you've set up and the translation of the Sofacto application in the Salesforce translation workbench, the PDF invoice is now available in English.
If you change the language on the invoice record and then create the PDF, you'll see this result:
If you wish to modify the current translations, please read the article: How to translate Sofacto labels and custom labels.
Setting up the model from Github
Once the prerequisites have been set up, you can retrieve the Visualforce code from our Github and copy it into a Visualforce page.
You'll find the procedure in detail in this article: Invoice template - Create your own PDF template (then click on Retrieve Visualforce code from GitHub).
Instead of the INVOICE_TEMPLATE model, choose :
INVOICE_TEMPLATE_ALL.
I can't save my Visualforce page!
This is linked to a poorly spelled API name.
Check these points carefully:
Name API labels well written as shown here.
API name of fields written as shown here.
Static resource for T&Cs implemented or Visualforce code removed from this section.
My page break is not working properly!
If your invoice PDF looks like this :
This indicates that you need to modify the page break conditions.
Please read the following article, which explains how to modify this condition.