action.skip

Storing Files in Salesforce Libraries and Folders

← Controlling File Distribution

JustOn Billing & Invoice Management 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 in Salesforce Files. This allows for organizing your files according to your business needs.

To this end, you create a dedicated File Distribution setting that specifies Folder in the field Backend and the complete path to the intended target library/folder in the field Path.

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

To create the File Distribution setting:

  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 for defining a distribution target include the name, the backend, the path and the activation marker. The use case is optional, depending on the files to be stored.

    Assuming you want produced files to be stored in the folder Z (see the example above), create a setting record like:

    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

    file_dist_libfolder

  5. Click Save.

    Applying this setting will produce files (using the default name pattern) and store them in Salesforce Files under Library 2/Folder Y/Folder Z.

Example: Save invoices and account statements to different Salesforce library folders

Assume you want to save PDF files for invoices and account statement to different folders in Salesforce Files. To this end, you have created the the following library/folder structure:

Documents
     ↳ Invoices
     ↳ Account Statements

Assume, in addition, that dunning reminders (First reminder and Second reminder) are not to be saved to either of the two directories.

To distribute the PDF files, you need two file distribution settings:

Setting 1
Field Value
Name Invoices
Active true
Backend Folder
Path Documents/Invoices
Select Condition ONB2__Type__c NOT IN ('Account Statement','First reminder','Second reminder')
Setting 2
Field Value
Name Account Statements
Active true
Backend Folder
Path Documents/Account Statements
Select Condition ONB2__Type__c = 'Account Statement'
Backend concepts

Generally, the File Distribution field Backend specifies the file distribution target.

Targets can be

  • target records in your Salesforce org (Invoice or Account) that will be linked with the produced PDF files
  • cloud storage services (GoogleDrive or AmazonS3) for storing produced documents
  • existing libraries and folders in Salesforce Files

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, for example, ON_Opportunity__c or ON_Contract__c. On PDF generation, JustOn links the file with the record referred to by the ID.

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 Billing & Invoice Management can generate public links to the produced PDF files. Make sure to test this functionality 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.