action.skip

File Distribution

JustOn Billing & Invoice Management generates PDF documents when finalizing invoices, dunning reminders and account statements. With this respect, JustOn provides a flexible control over how these documents are created and where they are put.

Export Settings or File Distribution?

JustOn Billing & Invoice Management uses the custom settings Export Settings and File Distribution to control the output of produced documents. It may be hard to tell which to apply. Remember that the two settings impact different aspects:

  • Export Settings records control what to export – invoice and bookkeeping data CSV files or SEPA XML files.
  • File Distribution settings control the output location of any produced files, be it PDF files for finalized invoices, dunning reminders and account statements, or exported CSV and XML files.

That is, your use cases determine which settings to use:

File export

If you export data to CSV files for accounting systems or to SEPA XML bank transfer orders, you need appropriate Export Settings records.

jo_faq_files_export
Exporting files (applying Export Settings) to the default location

File location

If you want produced PDF files for finalized invoices, dunning reminders and account statements to be output in a specific location (other than the group Owned by me in Salesforce Files), you need a corresponding File Distribution setting.

jo_faq_files_filedist
Defining a specific output location using a File Distribution setting

File export and file location

If you export data to CSV files for accounting systems or to SEPA XML bank transfer orders, you need appropriate Export Settings records. If you want the exported files to be output in a specific location, you need, in addition, a corresponding File Distribution setting.

To combine the two settings, the Name of the file distribution record must be specified as the Target in the export settings record.

jo_faq_files_export+filedist
Exporting files (applying Export Settings) to a specific location (applying File Distribution)

File Distribution Information

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

The following fields are available:

Field Possible Values Description
Name string A unique name for the custom setting record.
Specifies the name of the target folder when uploading exported files to Amazon S3 or Google Drive or saving exported files in Salesforce libraries and folders (to be set in the Target field of an Export Settings record).
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 links the file with 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
For the InvoicePDF use case, specifies the naming pattern used for the file name of invoice and dunning PDF documents to be generated.
The allowed characters include the alphanumeric characters a-z A-Z 0-9 as well as the underscore _ and hyphen - characters.
The pattern can 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.
If empty, defaults to [InvoiceDate]_[InvoiceNo]_[AccountName].pdf.
Print Folder (checkbox) true
false
If checked, only invoices marked with Print Invoice are saved to this distribution target.
Select Condition <conditionExpression> For the InvoicePDF use case, specifies a condition to restrict the selection of invoices, account statements or dunning reminders that are copied to this folder (a condition expression as used in an SOQL WHERE clause, like GrandTotal__c >= 0).
Make sure to query only fields that are available on both invoices (ONB2__Invoice__c) and statements (ONB2__Dunning__c).
For details, see SOQL WHERE clause 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.

Possible use cases include:

Using Salesforce Libraries and Folders Configuring Cloud Upload Enabling PDF Redistribution Enabling Draft PDF Distribution Defining Custom File Name Scheme Linking Files With Account

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. Click to enter Setup, then 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 and the backend.

    For details, see File Distribution Information.

  5. Click Save.