Custom Action to Apply Change Requests
You can implement customizations to apply change requests automatically. 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 | Apply Change Requests | ContractsServiceActionApplyChangeRequest |
Takes a change request ID and applies it to the active contract. Input options determine whether billing schedules are generated, and whether draft credit notes are created if refunds are due. |
The process runs synchronously but multiple change request IDs can be passed to the Apex action at once. For example, you might have a list view of billing contracts with Type=Change Request. By updating the Approval Status of multiple change requests to "Approved", multiple change request IDs will be passed to the Apex action simultaneously. For information about how many change requests might be updated via the list view, see Volume Information.
Input Parameters
The Apply Change Requests Apex action has the following input parameters for each change request passed to it.
Parameter |
Required or Optional |
Description |
---|---|---|
Change Request ID to be applied | Required | ID of the change request to be renewed. |
Disable creation of credit notes when applying the change request | Required |
Boolean to specify whether draft credit notes should be created for the active contract if refunds are due when the change request is applied. |
Generate Billing Schedules using a batch job that runs asynchronously | Required |
Boolean to specify whether billing schedules should be generated for the active contract when the change request is applied. When true, billing schedules are generated via a batch job. |
Output Values
Errors from the Apply Change Requests 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. You can notify the user of credit notes that have been created in the same way. For an illustration of how to do this, see Sample Flow to Apply Change Requests.
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 |
---|---|
Change Request ID that the action tried to apply | ID of the change request that the action has tried to apply. |
Credit Note ID created by applying this change request | ID of a draft credit note created when applying the change request. |
Error while applying this change request |
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. If multiple lines on the change request have errors, the error message for the first failure is returned. The number of the failed change request line and its active contract line are included in the message. |
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 Flow to Apply Change Requests
For an illustration of how a flow can be configured to use this Apex action, see Sample Flow to Apply a Change Request on Approval.
Volume Information
When updating the Approval Status of multiple change requests to "Approved" via the list view, we have found that Billing Central (when not using any customizations) can handle:
- 30 contracts with 10 lines each when schedule generation is disabled
- 20 contracts with 10 lines each when schedule generation is enabled
- 100 contracts with 1 line each when schedule generation is disabled
- 90 contracts with 1 line each when schedule generation is enabled
The contracts used for this testing had year long "Recurring Fixed" lines with a monthly billing term. No lines had usages, and proration policies were not applied.
The exact number of contracts that Billing Central can handle will vary depending on whether any customizations are implemented in your org, the size and complexity of your contracts, and platform limits. If you experience difficulties, try updating your change requests in smaller groups.