Sample Flow to Renew Contracts Using Fixed Input Parameters
This page describes a sample flow to renew contracts automatically with a price uplift of 40%.
Prerequisites
This sample flow has the following prerequisites:
In Billing Central, select the Automatically Populate Renewal Contract field in the Billing Central Settings custom setting. This configures Billing Central to link a contract to its renewal automatically. Billing Central does this by populating the Renewal Contract field on the original contract with a lookup to the renewal.
In the Flow Builder, go to the Toolbox and create a variable of Data Type = Text to store error messages.
Name this variable RenewalErrorMessage.
In the Flow Builder, go to the Toolbox and create a variable of Data Type = Boolean to store the success/fail outcome of the renewal action.
Name this variable RenewalHasErrors.
The Sample Flow
This sample flow is a Schedule-Triggered Flow where input parameters are passed to the Renew Billing Contracts Asynchronously Apex action as fixed values. There are two outcomes: a success outcome, and an error outcome which results in the returned error message being emailed to the user.
An explanation of each numbered item is provided in the table below.
#
Flow Element
Sample Flow Suggestion
Sample Flow Setup
1
On the Start element, click Set Schedule and enter appropriate schedule details. Note that the Start Time is in the org's default time zone.
1
On the Start element, click Choose Object. Set the object to Billing Contract and enter the following conditions so that the flow only attempts to renew contracts that are Active, have an End Date, and do not have a Renewal Contract (i.e. have not already been renewed):
ffbc__Status__c Equals Active ffbc__EndDate__c Is Null False ffbc__RenewalContract__c Is Null True
2
Add an Action element. Choose the Renew Billing Contracts Asynchronously action, then complete the input and output values.
Set Input Values
Billing Contract ID to be renewed: {!$Record.Id} Contract duration option: AsMonths Contract line duration option: KeepSame Percentage: 40
Store Output Values - assign these to the variables you created in "Prerequisites" steps 2 and 3.
Error Message: {!RenewalErrorMessage} Has Errors: {!RenewalHasErrors}
3
Add a Decision element to check for errors. Create a Renewal Has Errors outcome for if the Apex action returns an error. The condition for this outcome is:
RenewalHasErrors Equals True
4
For the Renewal Has Errors outcome, add a Send Email action then complete the input values.
Set Input Values
Body: An error occurred when renewing {!$Record.Name} :{!RenewalErrorMessage} Subject: Renewal Failed for Record {!$Record.Id} Recipient Email Addresses (comma-separated): {!$Record.Owner:User.Email} Sender Email Address: {!$User.Email}
5
Both the Renewal Has Errors outcome and the default outcome are now ended. The Flow Builder might display the two outcomes finishing at the same End element, or at separate End elements. This makes no difference to flow behavior.
Activate the flow
Remember to save and activate the flow to make it available for use.