This guide provides step-by-step instructions for installing and configuring the Peppol Invoicing managed package for Salesforce. This package enables you to send Peppol-compliant invoices directly from Salesforce, leveraging the power of PDF Butler.
1.In Salesforce Setup, use the Quick Find box to search for Permission Sets.
2. Find and click the PEPPOL Butler Admin permission set.
3. Click the Manage Assignments button.
4. Assign this permission set to the API user (or administrative user) responsible for the registration and Peppol API processing.
Assign ‘Peppol’ page latyout for the Actionable.Peppol Record Type. So, Admins can see all the Peppol fields on the Actionable when set Peppol record type:
a. Go to Setup -> Object Manager and Open Actionable object (cadmus_core__Actionable__c) -> Page Layouts and click ‘Page Layout Assignments’ button in the top right corner of the page.
b. Locate ‘Peppol’ record type. Then click ‘Edit Asignment’ and change a default to ‘Peppol’ page layout. Save changes.
Navigate to the Actionables related list on the Pack record you just created.
Click New to create a new Actionable record:
Name: Enter a descriptive name (e.g., Send Peppol Invoice)
Record Type:Peppol (This record type is added by the Peppol Invoicing package)
Class Name: cadmus_peppol.Peppol_ProcessInvoice
Flow API Name: Enter the API name of the custom Flow you will configure in the next section (e.g., Peppol_Invoice_JSON_Mapper). This Flow is called by the actionable and is required to map your Salesforce Invoice data into the Peppol Invoice Payload.
This Autolaunched Flow is the most critical part of the setup. It maps your Salesforce data to the Peppol_Invoice object, which is then sent to the API.
Use this element to retrieve your Salesforce Invoice record (and any related records, like Products or Contacts) using the recordId variable from the previous step.
3. Here Invoice Object in Salesforce has relationships (lookups) to Salesforce standard objects:
a. Account – we get customer data, like Billing Address.
b. Opporunity with Opportunity Products – we use as Invoice product lines.
Used Get Records Flow Component to retrieve these Related Objects:
7.4. Map Salesforce Data to the Peppol_Invoice Variable #
In the Flow’s Toolbox, click New Resource.
Create a new Variable with these properties:
API Name: Peppol_Invoice_Variable (or a name of your choice)
Data Type: Apex-Defined
Apex Class: cadmus_peppol.Peppol_Invoice
Make it available for Output.
Add an Assignment element to the Flow to map data from your Salesforce records (from step 7.3) to the Peppol_Invoice_Variable.
Mapping Salesforce Record and Static Values to Peppol Invoice #
The table below (see Apendix 1) details all properties of the cadmus_peppol__Peppol_Invoice object that must be set to create a valid Peppol Invoice. You will need to map all the requred properties to process Peppol Invoice sucessfully.
For all the Peppol Invoice variables from the table (Apendix 1) we will use Flow Assignment component. Some items can be assiged to static or (hardcoded values) otherwise you want to assign Salesforce Data – Object Records Fields. Let’s see an example how to do it step by step:
Map Invoice. Refer to the first table in the Apendix 1 – Top Level Invoice fields. In the first column Apex-Defined Variable (FLOW) – you can see all the variables you can populate with Salesforce Data.
Invoice Number. Below you can see the mapping (first variable). Under Variable field select Peppol_Invoice Apex-Defined variable you’ve created in previous step. Then you can see all the object properties, like INVOICE_NUMBER. Select this property.
{!Peppol_Invoice.INVOICE_NUMBER} equals {!InvoiceNumber},
– Where InvoiceNumber variable is a Flow formula to generate unique Invoice Name from the datetime: “BE25” & TEXT(DATETIMEVALUE(({!$System.OriginDateTime})))
In this way, InvoiceNumber Flow variable (can be a record field) is mapped into Peppol_Invoice.INVOICE_NUMBER object property.
Invoice Issue Date. In this case we map Opportunity.CloseDate (from GetRelatedObjects component):
2. Map Invoice Supplier (Sender). Refer to the second table in the Apendix 1 – Supplier Fields. In the first column Apex-Defined Variable (FLOW) – you can see all the variables you can populate with Salesforce Data for Invoice Supplier Object:
{!Peppol_Invoice.SUPPLIER.SENDER_NAME} equals ‘SuplierTradingName BV’ – to assign just a static text value.
{!Peppol_Invoice.SUPPLIER.SENDER_CONTACT_EMAIL} equals {!GetRelatedObjects.Account.Invoice_Email__c} – to assign custom email field from related Account.
3. Follow this approach to assign other properties:
4.Mapping Collections – Invoice Product Lines.
To map collections like invoice lines (which is an Array in the Peppol_Invoice object), you must use a Loop element.
Loop through your related Invoice Lines. In this example we loop Opportunity Products.
Assignment (in Loop): Create a new Apex-defined variable for a single line item (e.g., Peppol_Invoice_Line, using cadmus_peppol.Peppol_InvoiceLine class). Map the product fields to this single line variable.
Assignment (in Loop): Create a collection variable for the lines (e.g., Peppol_Invoice_Line_Collection, as a collection of cadmus_peppol.Peppol_InvoiceLine). Use the Add operator to add your single line variable to this collection.
Assignment (after Loop): Assign your Peppol_Invoice_Line_Collection to the Peppol_Invoice_Variable.LINES field.
When you successfully send an invoice, a Peppol Sales Invoice record is automatically created. This object tracks the status of the submission.
Invoice Status: This field tracks the two-step callback process:
Created: This is the first callback, indicating the invoice was successfully pushed to the Peppol network.
Processed: This is the second callback, indicating the invoice was fully processed by Peppol and a UBL document has been generated. At this stage, the UBL document will be attached to the Files related list of this PeppolSalesInvoice__c
SF_RecordId__c (cadmus_peppol__SF_RecordId__c): This field stores the Salesforce Record ID of the object you sent (e.g., your custom Invoice record). You can use this field in a Flow or Trigger to relate the PeppolSalesInvoice__c record back to your original Salesforce record.
During registration (or updating credentieals) from the Peppol Admin tab (step 2.2) above customers can enable / dissable Peppol Logs with the Enable Peppol Logs flag (enabled by default).
If you enable the logging, Peppol Log records will be created for the both successful and failed transactions. This is the first place to check if you encounter any callout or system errors when sending Peppol Invoices.