Skip to content

File Distribution

JustOn can generate PDF documents when creating invoices or dunnings. With this respect, JustOn provides a flexible control over how these documents are created and where they are put. For example, you want to store PDF copies of all invoices of a single invoice run in the same location, or you want to set up a specific naming scheme for your PDF invoices. Another possibility is to generate multiple PDF documents from a single invoice that are stored in different locations. From there, these copies can be moved to an external archiving system, printed to paper, or attached to invoicing emails.

File Distribution Information

The custom setting File Distribution controls the PDF generation and distribution.

Info

The custom setting File Distribution is available as of JustOn 2.49.

Up to JustOn 2.48, the custom setting PDF Folders controlled the PDF generation and distribution.

The following fields are available:

Field Possible Values Description
Name string A unique name for the custom setting record.
For cloud storage services (Amazon S3 or Google Drive), specifies the name of the target folder (see Configuring Export to Cloud Storage Services).
Active (checkbox) true
false
Specifies whether to use this distribution target or not.
Backend Invoice
Account
GoogleDrive
AmazonS3
Folder
Specifies the distribution target. Backends are either target records (invoices or accounts) in your Salesforce org that are linked to the PDF file, cloud storage services (Amazon S3 or Google Drive) for storing the documents, or existing libraries and folders in Salesforce Files.
ON_Opportunity__c
ON_Contract__c
As a specific backend use case, you can define the API name of an ID field (master-detail, lookup, formula) on the invoice that links to a specific object. On PDF generation, JustOn creates an attachment on the record referred to by the ID.
Draft Folder (checkbox) true
false
If checked, the distribution target will contain draft invoices only.
Link on Invoice (checkbox) true
false
For cloud storage services (Amazon S3 or Google Drive), specifies whether to link the PDF documents of this distribution target in the invoice.
Path <string>
specifying a library/folder location
For the Folder backend, specifies the complete path to the intended target location as set up in Salesforce Files.
PDF Name <string>
composed of placeholders and a file ending
Specifies the naming pattern used for the file name of the PDF document to be generated.
The pattern may include placeholders to insert dynamic content retrieved from the invoice record, like the creation date of the invoice. As a file distribution target can aggregate PDF invoices generated with different invoice runs, you may want the PDF name to be unique for each invoice. Unique names can be easily achieved by including the [InvoiceID] placeholder in the name pattern.
Note that even if the specified pattern does not create unique PDF names, the PDF documents will not be overwritten between invoice runs since Salesforce internally uses a different naming scheme to avoid naming conflicts. That is, if desired, you can give all invoices the same name, like invoice.pdf.
Print Folder (checkbox) true
false
If checked, only invoices marked with Print Invoice are saved to this distribution target.
Select Condition <SOQL WHERE clause> Specifies a condition to restrict the selection of invoices that are copied to this folder (in SQOL Syntax, like GrandTotal__c >= 0).
For details, see SOQL SELECT Syntax in the Salesforce Help.
This setting enables you to distribute the PDF documents over multiple folders. For example, you can define separate folders for invoices and credits. In this case, the credit folder has a select condition of GrandTotal__c < 0, and the invoice folder has a select condition of GrandTotal__c >= 0. All fields of the invoice and its related objects are accessible. If left empty (default), all invoice PDFs are included.
Note that every unique select condition produces an additional query during the PDF creation. Therefore, JustOn recommends to reduce the number of different filters to a minimum. Using exactly the same filter in multiple folders, however, adds only a single query.
Use Case InvoicePDF | Export Specifies the intended use case for the distribution target:
InvoicePDF for storing PDF files (invoices, account statements, dunning reminders), default if left empty
Export for exported invoice/booking details CSV or SEPA XML files
JustOn supports the use case Export with the backends AmazonS3, GoogleDrive and Folder only.

For example, assume that you want to set up the account as the file distribution target. You can apply the following settings:

Field Value
Backend Account
Name account
PDF Name [InvoiceDate]_[InvoiceNo]_[AccountName].pdf

This produces an invoice PDF with a name like 2018-06-30_2017-0018_JustOn.pdf and adds a link to the Salesforce file from the corresponding account record.

The following example shows a file distribution intended to upload CSV export files to Amazon S3:

Field Value
Backend AmazonS3
Name my-invoice-export:eu-central-1
Use Case Export
Active true

Info

With the use case Export, the fields Link on Invoice, Print Folder, Draft Folder, PDF Name and Select Condition are ignored and can therefore be left empty.

Defining File Distribution

Depending on your organization's requirements, you must define one or more file distribution targets.

Info

You can create multiple file distribution configurations.

To set up a file distribution target:

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of File Distribution.

  3. Click New.
  4. Specify the details as necessary.

    The mandatory information include the name, backend and PDF name.

  5. Click Save.

Enabling PDF Redistribution

Certain business use cases may require (re-)distributing existing PDF documents to a file distribution target, for example, in case the automatic distribution has failed or there is a new file distribution target to be populated. To this end, JustOn provides the custom button Distribute PDF. You can select records from list views and then use this button to distribute the corresponding PDF files to a (configurable) file distribution target.

Note

Use the redistribution function with caution. JustOn does not check the selected file distribution target for existing files, so distributing the same files to the same targets produces duplicates, which may consequently have unwanted effects.

To enable this option, you can add the button Distribute PDF to the following list views:

  • Invoices List View
  • Invoice Run Layout
  • Dunnings List View
  • Statement Run Layout

Draft Handling

JustOn supports generating PDF files for draft invoices for review or testing purposes. For details, see Creating Draft PDF.

With this respect, JustOn provides for the strict separation of Draft invoices from finalized invoices (Open, Paid, Settled, Canceled). To this end, the redistribution feature includes the option Only draft folders and invoices/dunnings. Together with the File Distribution setting Draft Folder (see File Distribution Information), this facilitates distributing either Draft invoices or finalized invoices.

Invoice Status to Consider Draft Folder Setting Only Draft Option
Open, Paid, Settled, Canceled false false
Draft true true

Info

Selected folders with non-matching draft settings are ignored.

Using Invoices List View or Dunnings List View

To add the button Distribute PDF to the Invoices List View or Dunnings List View, proceed as follows:

  1. Navigate to the object management settings of the Invoice or Dunning object.
  2. Click Search Layouts.
  3. Click Edit in the row of the Invoices List View or Dunnings List View, respectively.
  4. In the Custom Buttons section, move Distribute PDF to the Selected Buttons column.
  5. Click Save to save the modified page layout.

    For help about modifying layouts, see Managing Pages.

Using Invoice Run Layout or Statement Run Layout

To add the button Distribute PDF to the Invoice Run Layout or Statement Run Layout, proceed as follows:

  1. Navigate to the object management settings of the Invoice Run or Dunning Run object.
  2. Click Page Layouts.
  3. Click Edit in the row of the Invoice Run Layout or Dunning Run Layout, respectively.
  4. Scroll to the Related Lists section and click wrench to open the list properties.
  5. Open the Buttons section.
  6. Move Distribute PDF to the Selected Buttons column.
  7. Click OK to save the list properties.
  8. Click Save to save the modified page layout.

    For help about modifying layouts, see Managing Pages.

Storing Files in Salesforce Libraries and Folders

JustOn can store produced files - PDF files (invoices, account statements, dunning reminders) and exported invoice/booking details CSV or SEPA XML files - in libraries and folders. This allows for organizing your files according to your business needs.

Valid Library/Folder Paths

JustOn makes use of existing libraries and folders as set up in Salesforce Files. It does not create libraries or folders, however.

In order to allow JustOn accessing your libraries and folders, you need to model the path to your target, starting from your Files Home as root. Assume the following library/folder setup:

Library 1
    Folder A
    Folder B
Library 2
    Folder Y
        Folder Z

Assuming this example, the following paths are valid:

Intended Target Location Path (File Distribution Setting) Description
Library 1 Library 1 root a library
Folder B Library 1/Folder B a folder in a library
Folder Z Library 2/Folder Y/Folder Z a (nested) sub folder

File Distribution Setting

You enable the file distribution to libraries and folders using a corresponding File Distribution custom setting: The Backend field of the record must be set to Folder.

Field Example Value Description
Name Folder Z A unique name for the custom setting record. Can be referred to using the Target field of an Export Settings record.
Active true Specifies whether to use this distribution target or not. Only active distribution targets are considered.
Backend Folder Specifies the distribution target. Folder enables the library/folder-based backend.
Path Library 2/Folder Y/Folder Z Specifies the complete path as set up in Salesforce Files.
Use Case empty | Export Specifies the intended use case for the distribution target:
empty for storing PDF files (invoices, account statements, dunning reminders)
Export for exported invoice/booking details CSV or SEPA XML files

Implementation Restrictions

The following restrictions apply:

  • You can store a file only once per library in one (sub) folder. You can, however, save a file in multiple libraries.

    Assuming the example above: A file can reside either in Folder A or in Folder B, but not in both, and in Folder Y or Folder Z.

  • When you share a file with a library, the library settings define whether you can share the file using a public link.

    Review the library permissions and enable the Deliver Content permission.

    JustOn uses public links in the payment provider integration. Make sure to test your integration carefully together with the Folder backend.

Info

While we are confident that the Folder backend enhances JustOn's usability and operational excellence, we recommend to first test the feature in a Sandbox environment with respect to your business use cases.