Custom Action to Calculate Next Billing Dates
You can implement customizations to calculate a billing contract's next billing date. You can do this programmatically via the API, or you can do it without writing code by invoking the following Apex action from a Salesforce flow:
Category |
Apex Action | Apex Class | Purpose |
---|---|---|---|
Billing Contract | Calculate Next Billing Dates | BillingScheduleActionFindNextBillDates |
Takes the ID of a contract to have its next billing date calculated. The action calculates a contract's next billing date as the billing date of its next unbilled billing period. |
You could include this action in a flow that creates change requests for service credits. By including the Calculate Next Billing Dates action, the credit is included on the next billing document that's issued for the contract if you use the output to populate the First Bill Date on the new contract line.
Input Parameters
The Calculate Next Billing Dates Apex action has the following input parameter for each contract passed to it.
Parameter |
Required or Optional |
Description |
---|---|---|
Contract ID | Required | ID of the contract to have its next billing date calculated. |
Output Values
Errors from the Calculate Next Billing Dates Apex action are not recorded in logs. If you want to capture errors and notify the user (for example, by email or Salesforce task) you can store the return values in resources which are available to other flow elements. For an illustration of how to do this, see Custom Action to Calculate Next Billing Dates.
When configuring the action in a flow, click Advanced and select the Manually Assign Variables checkbox to store the following return values.
Output Variable |
Description |
---|---|
Contract ID | ID of the contract that had its next billing date calculated. |
Next Billing Date calculated by action | The next billing date that the action calculated for the given contract. |
Error while calculating this next billing date |
Assign this to a text variable which can be used to store the error message so that an Action element can email it to the user. |
Has Errors | Assign this to a boolean variable to store the outcome of the action, so it can be used by a Decision element later in the flow. |
Permissions
To configure a Salesforce flow to use this Apex action, you must be assigned a permission set that includes access to the corresponding Apex class. The class is included in the following packaged permission set:
- Billing Central API
For more information about creating Salesforce flows, see the Salesforce Help.
Sample Flows to Calculate Next Billing Dates
For illustrations of how flows can be configured to use this Apex action, see Sample Flow to Apply Service Credit via a Screen Flow and Sample Flow to Apply Service Credit via a Record-Triggered Flow.
Volume Information
When using this action in a record-triggered flow, we have found that Billing Central (when not using any customizations) can process 200 contracts with 9 lines each.
The exact number of contracts that Billing Central can handle will vary depending on other steps within the flow, whether any customizations are implemented in your org, the size and complexity of your contracts, and platform limits.