action.skip

Configuring Upload to Cloud Storage Services

← Setting Up Invoice Distribution

Usually, JustOn Billing & Invoice Management stores generated PDF files or exported CSV invoices in Salesforce files and associates them with various records like invoices, accounts or opportunities. Your organization's business may, however, require to upload the exported files to cloud storage services like Amazon S3 or Google Drive.

Depending on the files to be stored, setting up the file upload to cloud storage services may comprise multiple configuration tasks:

In addition, you can monitor the upload status.

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)

Once set up, there are various ways to upload generated files to your cloud storage:

Note

Users who trigger file uploads to cloud storage services – either immediately on invoice or statement finalization with a dedicated File Distribution setting or using the PDF (re-)distribution feature – must be assigned

  • the system permission "Customize Application" and
  • the app permission "Query All Files"

in their profile or using a dedicated permission set. To this end, they need a (full) Salesforce user license – other license types, like Salesforce Platform, may not be sufficient.

Setting Up Storage Location

Amazon S3

JustOn Billing & Invoice Management can integrate with Amazon Simple Storage Service (Amazon S3) to store generated files. Keeping a single active S3 user credential, JustOn can access an unlimited number of buckets simultaneously.

Info

To ease the file management within a bucket, Amazon S3 supports the automatic (sub) folder creation based on specifically defined PDF name patterns, where slashes (/) indicate folders, like /[AccountNo]/[InvoiceNo].pdf.

Before configuring JustOn to connect to Amazon S3, you must create the intended Amazon S3 buckets first. For details, see the Amazon Simple Storage Service Documentation.

Info

The permissions for accessing uploaded files are controlled using specific Amazon S3 access control policies associated to your buckets. For details, see Managing Access Permissions to Your Amazon S3 Resources in the AWS Documentation.

Configuring JustOn to connect to Amazon S3 involves these tasks:

Creating File Distribution Setting for Amazon S3

To temporarily hold the files to be uploaded, JustOn needs a dedicated 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.

    Field Possible Values Description
    Backend AmazonS3 Specifies the backend where the target folder is located. For using Amazon S3, the value must be AmazonS3.
    Name <bucket>:<region> Specifies the exact name of the target folder, for Amazon S3 buckets, this is the bucket name and the region, separated by a colon.
    The bucket name and the storage folder name must match.
    To find your Amazon S3 region, see AWS Regions and Endpoints.
    Active (checkbox) true Specifies whether to use this folder or not. Must be selected to enable the export.
    PDF Name [InvoiceNo]_[AccountName].pdf For the InvoicePDF use case, specifies the naming pattern used for the file name of the PDF document to be generated.
    Slashes in the naming pattern are considered folders during the S3 upload, like /[AccountNo]/[InvoiceNo].pdf.
    Select Condition <conditionExpression> For the InvoicePDF use case, specifies a condition expression as used in an SOQL WHERE clause to restrict the selection of PDF documents that are distributed to this target.
    For more details and an example, see File Distribution Information.
    Use Case InvoicePDF
    Export
    Specifies the intended use case for the folder:
    InvoicePDF for distributing PDF files (invoices, account statements, dunning reminders), default if left empty
    Export for invoice/booking details CSV or SEPA XML files to be exported

    file_dist_amazon
    Creating a file distribution target for uploading files to Amazon S3

  5. Click Save.

    This enables the file distribution target for redistributing PDF files or as a target for exported files.

Info

With the use case Export, the fields PDF Name and Select Condition are ignored and can therefore be left empty.

Creating Remote Sites for Amazon S3 Buckets

For each Amazon S3 bucket you intend to use with JustOn, you must configure a remote site in Salesforce.

With respect to the URLs, consider the following characteristics:

  • The region is always part of the URL, with the exception of the US East (us-east-1) region.
  • JustOn prefers to callout to virtual host style URLs like

    https://<bucket>.s3.amazonaws.com/
    
    https://<bucket>.s3-eu-west-1.amazonaws.com/
    
  • If the bucket name contains full stop characters (like foo.bar), JustOn falls back to path style URLs:

    https://s3.amazonaws.com/<bucket>
    
    https://s3-eu-west-1.amazonaws.com/<bucket>
    

To configure a remote site:

  1. Click to enter Setup, then open Remote Site Settings.

    In Salesforce Lightning, navigate to Security > Remote Site Settings.

    In Salesforce Classic, navigate to Security Controls > Remote Site Settings.

  2. Click New Remote Site.

  3. Specify the details as necessary.

    Use a descriptive name that helps to unequivocally identify the setting.

    For information about the mandatory fields and possible values, see Configure Remote Site Settings in the Salesforce Help.

  4. Click Save.

Amazon S3 Bucket Configuration Examples

Bucket Name Region File Distribution Setting Name Remote Site Setting URL
foo US East foo:us-east-1 https://foo.s3.amazonaws.com/
foo.bar US East foo.bar:us-east-1 https://s3.amazonaws.com/
foo EU Central foo:eu-central-1 https://foo.s3-eu-central-1.amazonaws.com
foo.bar EU Central foo.bar:eu-central-1 https://s3-eu-central-1.amazonaws.com

Granting Amazon S3 Access for JustOn

Before JustOn can upload files to your Amazon S3 storage, you must grant it the corresponding access rights.

  1. Open JustOn's Amazon S3 page.

    Use the following URL https://login.salesforce.com/apex/ONB2__ManageAmazonS3, or, if you are already logged in, append apex/ONB2__ManageAmazonS3 to your org's domain name.

    You can access the Manage Amazon S3 page via the JustOn configuration app ( > JustOn Configuration > Manage Amazon S3).

  2. Specify your AWS Access Key ID and Secret Access Key in the corresponding fields.

  3. Click Save.

Info

JustOn's Amazon S3 page also allows to repeat the upload in case the job has failed, clicking Upload Remaining Documents, and to provide a new Access Key ID and Secret Access Key for another AWS account.

Google Drive

JustOn Billing & Invoice Management can integrate with Google Drive to store generated files. Keeping a single active Google user credential, JustOn can access an unlimited number of Google Drive folders in parallel.

Note

As opposed to Amazon S3, Google Drive does not support the (sub) folder generation from corresponding PDF name patterns.

Info

The permissions for accessing uploaded files are controlled via the sharing settings defined for your Google Drive folders. For details, see Share folders in Google Drive in the Google Drive Help.

Creating File Distribution Setting for Google Drive

To temporarily hold the files to be uploaded, JustOn needs a dedicated 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.

    Field Possible Values Description
    Backend GoogleDrive Specifies the backend where the target folder is located. For using Google Drive, the value must be GoogleDrive.
    Name Google Specifies the exact name of the target folder.
    If the folder does not exist, Google Drive creates it applying the specified name.
    Active (checkbox) true Specifies whether to use this folder or not. Must be selected to enable the export.
    PDF Name [InvoiceNo]_[AccountName].pdf For the InvoicePDF use case, specifies the naming pattern used for the file name of the PDF document to be generated.
    Google does not support the (sub) folder generation from corresponding name patterns, as opposed to Amazon S3.
    Select Condition <conditionExpression> For the InvoicePDF use case, specifies a condition expression as used in an SOQL WHERE clause to restrict the selection of PDF documents that are distributed to this target.
    For more details and an example, see File Distribution Information.
    Use Case InvoicePDF
    Export
    Specifies the intended use case for the folder:
    InvoicePDF for distributing PDF files (invoices, account statements, dunning reminders), default if left empty
    Export for invoice/booking details CSV or SEPA XML files to be exported

    file_dist_amazon
    Creating a file distribution target for uploading files to Google Drive

  5. Click Save.

    This enables the file distribution target for redistributing PDF files or as a target for exported files.

Info

With the use case Export, the fields PDF Name and Select Condition are ignored and can therefore be left empty.

Granting Google Drive Access for JustOn

Before JustOn can upload files to your Google Drive storage, you must grant it the corresponding access rights.

  1. Open JustOn's Google Drive page.

    Use the following URL https://login.salesforce.com/apex/ONB2__ManageGoogleDrive, or, if you are already logged in, append apex/ONB2__ManageGoogleDrive to your org's domain name.

    You can access the Manage Google Drive page via the JustOn configuration app ( > JustOn Configuration > Manage Google Drive).

  2. Specify your Google user name in the corresponding field.

  3. Click Authenticate.
  4. Follow Google's instructions to authenticate yourself and to allow JustOn to access your Google Drive storage.

    Once completed, you are taken back to JustOn's Google Drive page.

Info

JustOn's Google Drive page also allows to repeat the upload in case the job has failed, clicking Upload Remaining Documents, and to revoke JustOn's access to the current Google account.

Defining Specific Export Settings

If you intend to directly upload exported files to your cloud storage, you need a specific CSV export setting. You can adjust an existing setting or create a new one – just make sure to specify the exact document folder name as the export 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 Export Settings.

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

    Field Possible Values Description
    Name S3 A unique name for the custom setting record, will be selectable when exporting invoice data.
    Active true
    false
    Determines whether the configuration is available in the UI.
    Configuration <Salesforce record ID> Specifies the Salesforce record ID of the JSON configuration file, which is required for CSV exports
    Create Payments true
    false
    Determines whether to create payment balances on the invoices upon exporting, which sets the invoices Paid or Settled.
    Users can overwrite this option manually when starting the export.
    Format Invoice CSV Determines the export format.
    Select Condition Date__c = THIS_YEAR Specifies a condition expression as used in an SOQL WHERE clause to restrict the set of included records. If empty, matches all invoices in the scope.
    For details, see SOQL WHERE clause in the Salesforce Help.
    Target my-export:eu-central-1 Specifies the Name of a file distribution target for the exported files.
    Note that the file distribution target must be the one set up for the invoice export to your cloud storage service (see Setting Up Storage Location).

    file_dist_amazon
    Creating an export settings record for uploading files to Amazon S3

  5. Click Save.

    This enables users to select this export setting when executing or scheduling exports.

Monitoring Cloud Storage Export

For administrative purposes, you may need to monitor the cloud storage export. JustOn Billing & Invoice Management therefore keeps track of the external targets and the corresponding upload status. To this end, it adds specific fields to the Content Version object, which are then used to maintain the corresponding information for the Salesforce files.

The following fields are currently available:

Field Values Description
External Targets JSON String Holds a list of all cloud folders (and the associated status) to which the file will be or has been uploaded.
Amazon S3 Transfer Status New
Partial
Transferred
Maintains the cumulated transfer status over all single Amazon S3 folders of the external targets.
Google Drive Transfer Status New
Partial
Transferred
Maintains the cumulated transfer status over all single Google Drive folders of the external targets.

Note

Users who trigger file uploads to cloud storage services must be given access to these fields in their profile or using a dedicated permission set.