Enabling JustOn Cash Management
Your business may use JustOn Cash Management to directly integrate Salesforce CRM with German or other European banks as well as payment service providers.
Info
The integration with JustOn Cash Management as outlined below is available as of JustOn Billing & Invoice Management 2.76.
The integration requires JustOn Cash Management to be set up properly. For details, see Setting Up JustOn Cash Management.
Integrating JustOn Billing & Invoice Management with JustOn Cash Management involves the following tasks:
- Configuring the required data relations (lookup from entry to invoice/installment, lookup from balance to payment/entry item, PDF preview on entry)
- Enabling the balance creation using flows
- Activating the integration
Info
Instead of manually setting up the data relations and flows, you can deploy the required configuration using a dedicated JustOn Configurator package.
Integration Concepts
The payment functionality shipped with JustOn Cash Management is centered around entries (see Receivables/Payables Concepts). These records hold all information with respect to an amount of money owed to or requested by a business partner, based on statements that justify the corresponding request.
In JustOn Billing & Invoice Management, the produced invoices or – if set up and used – installments represent payment requests. Now integrating JustOn Billing & Invoice Management with JustOn Cash Management provides for both
- the creation of the relevant entry records upon invoice finalization or installment creation/modification, and
- the creation of the relevant balance records for a registered money flow (where the field
Origin
is set toJPAY1
).
Creating entries on invoice finalization or installment creation, creating balances for payments
Note
Integrating JustOn Billing & Invoice Management with JustOn Cash Management will change your workflows.
Payment-related balances produced for a registered money flow in JustOn Cash Management (where the field Origin
is set to JPAY1
) must not be subject to balance-based business processes like automatic assignment to invoices or balance transfer. To cover these use cases, you manually associate entries with payments in JustOn Cash Management.
Balance creation details
In JustOn Cash Management, registering a money flow for a payment record results in a modified amount value of the payment with a possible settlement to an entry. "Translating" this to JustOn Billing & Invoice Management means to create or update balance records.
In the simplest use case, there are 1:1 relations – one invoice (or installment) makes one entry, and one payment settled with this entry makes one balance record associated to the invoice.
JustOn Cash Management can, however, relate entries with payments in an n:m relationship. This allows, for example, to distribute one money transfer to multiple entries or to settle one entry with multiple money transfers.
The integration with JustOn Billing & Invoice Management provides for the creation of the relevant balances. The system takes the registered payment amount per entry and compares it to the existing payment balance (with Origin
= JPAY1
) of the original invoice – producing new payment balance records in the amount of the difference, associated to the original invoices or, in case of overpayments or payments without entry settlement, to the related account.
The following examples illustrate this behavior.
Multiple payments for one invoice
# | Step | Payment Amount | Settled Amount per Entry | Existing Balance | Produced Balances |
---|---|---|---|---|---|
1 | Finalize invoice I1 100 |
0 | I1: 0 | ||
2 | Partial payment P1 80 |
80 | 80 | I1: 0 | I1: Payment P1 -80 |
3 | Partial payment P2 20 |
20 | 100 | I1: -80 | I1: Payment P2 -20 |
Multiple payments for multiple invoices
# | Step | Payment Amount | Settled Amount per Entry | Existing Balance | Produced Balances |
---|---|---|---|---|---|
1 | Finalize invoice I1 100 |
0 | I1: 0 | ||
2 | Finalize invoice I2 100 |
0 | I2: 0 | ||
3 | Partial payment P1 180 |
180 | I1: 100 I2: 80 |
I1: 0 I2: 0 |
I1: Payment P1 -100 I2: Payment P1 -80 |
3 | Partial payment P2 20 |
20 | I1: 100 I2: 100 |
I1: -100 I2: -80 |
I2: Payment P1 -20 |
Multiple payments for an invoice with installments
# | Step | Payment Amount | Settled Amount per Entry | Existing Balance | Produced Balances |
---|---|---|---|---|---|
1 | Finalize invoice I1 100 4 installments |
0 0 0 0 |
I1: 0 | ||
2 | Partial payment P1 80 |
80 | 25 25 25 5 |
I1: 0 | I1: Payment P1 -80 |
3 | Partial payment P2 20 |
20 | 25 25 25 25 |
I1: -80 | I1: Payment P2 -20 |
Overpayment, producing a "free" balance on the account A1
# | Step | Payment Amount | Settled Amount per Entry | Existing Balance | Produced Balances |
---|---|---|---|---|---|
1 | Finalize invoice I1 100 |
0 | I1: 0 | ||
2 | Payment P1 120 |
120 | I1: 100 | I1: 0 | I1: Payment P1 -100 A1: Payment P1 -20 |
Data mapping: invoice/installment → entry
Entries hold all information with respect to an amount of money owed to or requested by a business partner. The entries' data is based on invoice data or on installments data and, if applicable, on already received payments. If a payment plan is modified after the invoice finalization producing new installments, the existing entry records are deleted, and new entry records are created accordingly.
The following fields are set on entry creation:
Data Category | Entry Field | Invoice Source Field | Installment Source Field | Default Value/Notes |
---|---|---|---|---|
General | Type | Debit for positive amountCredit for negative amount |
||
Title | Invoice: custom label with invoice number Installment: custom label with title and invoice number |
|||
Payment Reference | String built as defined in the Payment Reference field of the template, see Configuring Payment Reference Text |
|||
Business Entity | Tenant |
Invoice__r.Tenant |
The business entity record in JustOn Cash Management is modified or created on entry record creation using the values given by the invoice. | |
Requests | Requested Payment Method | PaymentMethod |
Invoice__r.PaymentMethod |
|
Requested Payment Provider | RequestedPaymentProvider |
Invoice__r.RequestedPaymentProvider |
Optional lookup to JPAY1__PaymentProvider | |
Requested Payment Instrument | RequestedPaymentInstrument |
Invoice__r.RequestedPaymentInstrument |
Optional lookup to JPAY1__PaymentInstrument | |
Requested Bank Account | RequestedBankAccount |
Invoice__r.RequestedBankAccount |
Optional lookup to JPAY1__BankAccount | |
Customer Data | BP Number | DebtorNo orAccount__r.ON_DebtorNo |
Invoice__r.DebtorNo orInvoice__r.Account__r.ON_DebtorNo |
Optional |
BP Type | Debtor |
|||
Account | Account |
Invoice__r.Account |
||
Account Name | AccountName |
Invoice__r.AccountName |
||
Contact | EmailContact |
Invoice__r.EmailContact |
||
Statement Data | Statement Type | Invoice \ |
||
Statement Description | ||||
Statement No | Name |
Invoice__r.Name |
||
Invoice | Id |
Invoice |
Lookup to entry source | |
Installment | Id |
Lookup to entry source | ||
Statement Distribution URL | ContentDistributionUrl |
Invoice__r.ContentDistributionUrl |
||
Dates | Statement Date | Date |
Invoice__r.Date |
|
Statement Payment Due Date | NextPaymentDueDate |
Date |
||
Service Period Start | ServicePeriodStart |
ServicePeriodStart |
||
Service Period End | ServicePeriodEnd |
ServicePeriodEnd |
||
Amount | Status | Status |
PaymentStatus |
Open → Open Paid → Balanced |
Open Amount | NextPaymentDue |
OpenPaymentAmount |
Configuring Data Relations
Info
Instead of manually setting up the data relations, you can deploy the required configuration using a JustOn Configurator package.
Enabling Entry Lookups
As entries are always linked to the original statements, you must allow for relating the produced entries with the original invoices or statements. To this end, you create lookup fields on the Entry object.
- Navigate to the fields list of the Entry object.
-
Create the following new fields.
API Name Data Type Description Invoice Lookup (Invoice) Links to the related invoice.
Must be writable.Payment Lookup (Payment) Links to the related installment ( ONB2__Payment__c
object).
Must be writable.Make sure to allow the relevant users access to the new fields by adding them either to their assigned profiles or permission sets.
Relating the correct Payment object ONB2__Payment__c
With JustOn Billing & Invoice Management and JustOn Cash Management installed in one Salesforce org, there may be three Payment objects (Payment
, ONB2__Payment__c
, JPAY1__Payment__c
). Unfortunately, the picklist presented when creating the lookup field does not show the object API name.
To verify whether you have selected the correct Payment object (ONB2__Payment__c
) to relate entries with installments, you can use lookup filters:
-
In step 3 of the field creation wizard, expand the lookup filter settings.
If you do not see lookup filters, you have selected the Salesforce standard object Payment. In this case, go back to step 2 of the wizard and select another Payment object.
-
In the Filter Criteria section, click the lookup icon next to the
Field
field.The available fields for the Payment object must include, among others,
Account No.
andAmount
. If this is the case, you have selected the correct Payment object.If these fields are not listed, you have selected the custom object Payment from JustOn Cash Management. In this case, go back to step 2 of the wizard and select another Payment object.
-
If you have selected the correct Payment object, close the filter settings without setting up a filter (you do not need one) and proceed with creating the lookup field as prompted.
Enabling Balance Lookups
As balances are created or updated as a result of a money flow, you must allow for relating the produced balances with the original payments and, if payments are settled with entries, with the entry items in addition. To this end, you create lookup fields on the Balance object.
- Navigate to the fields list of the Balance object.
-
Create the following new fields.
API Name Data Type Description CM_Payment Lookup (Payment) Links to the related payment in JustOn Cash Management ( JPAY1__Payment__c
object).
Must be writable.CM_EntryItem Lookup (EntryItem) Links to the related entry item (if the payment is settled with an entry).
Must be writable.Make sure to allow the relevant users access to the new fields by adding them either to their assigned profiles or permission sets.
Relating the correct Payment object JPAY1__Payment__c
With JustOn Billing & Invoice Management and JustOn Cash Management installed in one Salesforce org, there may be three Payment objects (Payment
, ONB2__Payment__c
, JPAY1__Payment__c
). Unfortunately, the picklist presented when creating the lookup field does not show the object API name.
To verify whether you have selected the correct Payment object (JPAY1__Payment__c
) to relate balances with JustOn Cash Management payments, you can use lookup filters:
-
In step 3 of the field creation wizard, expand the lookup filter settings.
If you do not see lookup filters, you have selected the Salesforce standard object Payment. In this case, go back to step 2 of the wizard and select another Payment object.
-
In the Filter Criteria section, click the lookup icon next to the
Field
field.The available fields for the Payment object must include, among others,
Assigned Amount
andAvailable Amount
. If this is the case, you have selected the correct Payment object.If these fields are not listed, you have selected the custom object Payment from JustOn Billing & Invoice Management. In this case, go back to step 2 of the wizard and select another Payment object.
-
If you have selected the correct Payment object, close the filter settings without setting up a filter (you do not need one) and proceed with creating the lookup field as prompted.
Enabling PDF Preview
Entries provide a public link to the PDF of the original statement. To support this, you must set up the corresponding public file link generation for invoices. This involves enabling the content distribution and creating the PDF preview URL field.
To enable the content distribution:
-
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.
-
Click Manage in the row of Global Settings.
- Click Edit in the Default row.
- Select the checkbox
Always Create Content Distribution
. - Click Save.
To create the PDF preview URL field:
- Navigate to the fields list of the Invoice object.
-
Create the following new field.
API Name Data Type Description ContentDistributionUrl URL Specifies the public link to the PDF preview.
Make sure to grant edit access for all users who finalize invoices.
Once set up, this will copy the value from the Content Distribution URL
field on the invoice to the Statement Distribution URL
on the produced entry.
Enabling Balance Synchronization
Registering a money flow for a payment record results in a modified amount value of the payment with a possible settlement with an entry (see Integration Concepts). This modification can be used to trigger flows that create or update relevant balances of the related invoices or, if applicable, the accounts.
To this end, configure custom flows that call the appropriate Apex class Create payment balances
provided by JustOn triggered by payment modifications and entry item modifications.
Info
Instead of manually setting up the flows, you can deploy the required configuration using a JustOn Configurator package.
Payment Trigger
- Click to enter Setup, then navigate to Process Automation > Flows.
- Click New Flow.
- Select
Record-Triggered Flow
and click Create. -
Configure the Start element.
Option Value Object Payment
(JPAY1__Payment__c)Trigger A record is created or updated
Conditions None Optimize for Actions and Related Records
-
Click and add the following Action element.
Option Value Action Create payment balances
Label Synchronize Balances and Payments
API Name Synchronize_Balances_and_Payments
Description Execute balance synchronization for new/updated payments
Input Values {!$Record.Id}
-
Click Save.
Specify a label, an API name and a description for the flow as required, for example:
Option Value Flow Label CashMgmt Integration - Create/Update Payment
Flow API Name CashMgmt_Integration_Create_Update_Payment
Description Synchronization of payments with balances
-
Click Activate
JustOn creates the payment balances with the field
Origin
set toJPAY1
for every created or updated payment record.For help about creating flows, see Flows in the Salesforce Help.
Settlement Trigger
- Click to enter Setup, then navigate to Process Automation > Flows.
- Click New Flow.
- Select
Record-Triggered Flow
and click Create. -
Configure the Start element.
Option Value Object Entry Item
(JPAY1__EntryItem__c)Trigger A record is created or updated
Conditions None Optimize for Actions and Related Records
-
Click and add the following Action element.
Option Value Action Create payment balances
Label Synchronize Balances and Entry Items
API Name Synchronize_Balances_and_Entry_Items
Description Execute balance synchronization for new/updated entry items
Input Values {!$Record.JPAY1__Payment__c}
-
Click Save.
Specify a label, an API name and a description for the flow as required, for example:
Option Value Flow Label CashMgmt Integration - Create/Update Entry Item
Flow API Name CashMgmt_Integration_Create_Update_Entry_Item
Description Synchronization of entry items (settlements) with balances
-
Click Activate
JustOn creates the payment balances with the field
Origin
set toJPAY1
for every created or updated entry item (settlement) record.For help about creating flows, see Flows in the Salesforce Help.
Deleting Records
Note
The deletion of records is not supported.
The business logic of JustOn Cash Management is implemented in a way that during the normal operation, the system will never delete entries, entry items and payments. Be aware that manual delete operations that bypass the implemented rules will not be synchronized.
Deploying Integration Configuration
Instead of manually setting up the data relations and flows, you can deploy the required configuration using the dedicated JustOn Configurator package. To do so:
- Log in your target Salesforce org.
-
In the same browser session, open the JustOn Configurator.
If the link does not work, copy the URL
https://juston-configurator.herokuapp.com/
. -
Click Salesforce OAuth2.
This connects the JustOn Configurator with your current Salesforce session using your current credentials. Make sure that you are connected with the intended user and org.
Verifying session settings -
Scroll down the list to find the package
Billing - Cash Management Integration
. -
Click Deploy.
This deploys the data relation and flow configuration as required for the integration of JustOn Billing & Invoice Management with JustOn Cash Management.
Be aware that you must still activate the integration manually.
Activating Integration
To activate the integration with JustOn Cash Management, enable the corresponding global setting:
-
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.
-
Click Manage in the row of Global Settings.
- Click Edit in the Default row.
- Select the checkbox
Enable JustOn Cash Management
. - Click Save.
Handling Payment Page Links
JustOn Cash Management includes a payment page. It provides your buyers the option to pay their purchases (represented as entries) via integrated payment service providers.
In order to invite your buyers to pay, you publish a link to your payment page. This payment link looks like
https://payment.juston.cloud/pay/:link-id/to/:tenant
where :link-id
encodes the relevant entries and :tenant
represents your organization.
Payment page link concepts
After integrating with JustOn Cash Management, JustOn Billing & Invoice Management retrieves the produced payment links using two batch processes: BatchGetEntryPaymentLinks and BatchGetInvoicePaymentLinks. They are executed by the finalization batch chain before generating the PDF files, which allows to add the payment links to invoice PDF documents.
To set payment page links on invoice finalization, the following conditions must be met:
- The requested payment method for the entries must be
Credit Card
. That is, the entries must have been created for invoices with the payment methodCredit Card
. - There is an active payment provider.
Individually finalizing a single invoice from its detail view will not execute the finalization batch chain. In this case, no payment links will be set on the invoice.
- BatchGetEntryPaymentLinks
- On invoice finalization, the batch class BatchGetEntryPaymentLinks retrieves the payment page links for all related entries. If an entry is directly related to an invoice, the process writes link to the field
Payment Page URL
on the invoice. If, however, an entry is related to an installment (see Integration Concepts), the process writes the link to the fieldPayment Page URL
on the installment. Error messages are written to the fieldPayment Page URL Error
. - BatchGetInvoicePaymentLinks
- For installment invoices, the entries are related to installments, thus the batch class BatchGetEntryPaymentLinks will not write a payment link to the invoice. So the batch class BatchGetInvoicePaymentLinks generates a combined payment link for all installments related to an invoice and writes the result to the
Payment Page URL
field on the invoice. - As a result, there is always a payment link on the invoice, either for a single entry if there are no installments, or for all installments of the invoice. If there are installments, each installment will get an individual payment link in addition.
Enabling payment page link handling in JustOn Billing & Invoice Management involves
- Enabling the link retrieval after finalizing invoices
- Adding the link to the invoice email or PDF
Enabling Link Retrieval After Finalization
In case of installment modifications or errors, or after finalizing an invoice from its detail view, users can update the links to the payment page. To enable this option, you add the Get Payment Links button to the Invoices list view.
- Navigate to the object management settings of the Invoice object.
- Click List View Button Layout.
- In the List View row, click to open the action menu, then select Edit.
-
Under Custom Buttons, move
Get Payment Links
to the Selected Buttons column.
Adding a custom button to a related list -
Click Save to save the modified page layout.
This makes the Get Payment Links button available on the Invoices list view.
Enabling Link Distribution
Using the built-in placeholder [PaymentPageURL]
, you can add the link to the relevant payment page to the invoice email or invoice PDF document.
Adding Link to Email or PDF
To add the payment link for an invoice (or a combined payment link for all installments of an invoice) to the invoice email or invoice PDF document, you add the built-in placeholder [PaymentPageURL]
to the intended text field of the relevant template.
- Open the template to be edited.
-
In the intended text field, include the placeholder in the text body.
Possible target text fields mya be
Text 2
orText 3
for the PDF andEmail Body
orEmail HTML Body
for the email.Make sure to apply the placeholder filter
no-persist
to the placeholder, like[PaymentPageURL|no-persist]
-
Click Save.
For details, see Editing Standard Text Blocks or Modifying Invoice Email.
Customizing Email or PDF Link Display
The placeholder [PaymentPageURL]
masks the URL, showing the custom label PaymentPage
instead. Optionally, you can override this label to display a custom text.
Info
To modify custom labels, you must enable the Translation Workbench. For details, see Enable and Disable the Translation Workbench in the Salesforce Help.
- Click to enter Setup, then navigate to User Interface > Custom Labels.
- Click the name of the label
PaymentPage
. - Click New Local Translations/Overrides.
- Select the target language and specify the text as required.
-
Click Save.
For details about modifying custom labels, see Create and Edit Custom Labels in the Salesforce Help.
Adding Payment Links to Installment Table
For invoices with payment plans, there are individual payment links for each involved installment. You can add these links to the installment table on the invoice PDF.
On the Payment object (ONB2__Payment__c), the formula field Payment
(API name ONB2__PaymentLink__c
) builds a clickable link to the payment page using the value set in the field Payment Page URL
. Similar to the placeholder [PaymentPageURL]
, the formula masks the URL, showing the custom label PaymentPage
instead.
To add the payment links to the installment table:
- Open the template to be edited.
-
In the
Installment Columns
field, specify the table configuration as required.To display the payment link in addition to the default columns, specify
Title__c;Date__c;Amount__c;PaymentLink__c
-
Click Save.
For details on modifying the installment table, see Configuring Installment Table on Invoices.
Info
By default, the installment table uses the field label as column header. Optionally, you can override the label using the template field Override Labels
. For details, see Modifying Installment Table Column Headers.