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
Specifies the distribution target. Backends are either target records (invoices or accounts) in your Salesforce org that are linked to the PDF file, or cloud storage services (Amazon S3 or Google Drive) for storing the documents.
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.
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. If empty, defaults to InvoicePDF. For storing files generated by exports, set Export.
JustOn supports the use case Export with the backends AmazonS3 and GoogleDrive 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 checked

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

Depending on your business use cases or your organization's requirements, you must distribute existing invoices or dunning reminders to a new (or another existing) file distribution target. To this end, JustOn provides a custom button that allows you to select records from list views and distribute the corresponding PDF files to a configurable target.

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 the strict separation of Draft invoices from finalized invoices (Open, Paid, Settled, Canceled). This is why 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 Page Layouts.

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 Page Layouts.