How to exclude source records from subscription building?
← Billing & Invoice Management FAQ
Your business can use automatic subscription building in order to deal with a large or variable – read: increasing – number of subscriptions.
Now assume that you want to exclude specific source records from being subject to the automatic subscription build based on certain conditions. How to do so?
JustOn recommends to use a custom field on the source object that is then to be used as an exclude (or include) condition in the subscription build filter. In the easiest way, this custom field is a checkbox that is set using a formula or a flow based on your requirements.
Note
We advise against using validation rules to exclude source records from subscription building. Validation rules are a powerful means to ensure data quality, but this is not your goal here – you just want to set and check one condition. Besides, validation rules may have a considerable performance impact and may have unwanted effects on other business processes.
Think of the following example:
You build subscriptions from opportunities. Usually, the opportunity state is the perfect trigger to invoke the subscription builder: you define a corresponding condition in your subscription build filter. The condition is an expression (as used in an SOQL WHERE clause) that restricts the set of involved records, like Status = 'Activated'
– this makes sure that only opportunities of the state Activated
will be subject to the subscription build.
The opportunity state, however, may not be enough. Assume you want to exclude opportunities of a certain account. In this case, you add an exclude condition to the filter, like Status = 'Activated' AND ON_Account__c != '<ID>'
.
Now assume you want to apply some custom logic to set a "trigger field" based on certain conditions. You create a custom checkbox, like Billable
, to include only records where the checkbox is selected, excluding records where the checkbox is not selected. To cover this, your subscription build filter sets this condition: Status = 'Activated' AND Billable__c = true
.
Info
You can set up the checkbox as a formula field or use Salesforce flows to have the checkbox selected automatically. This way, you can apply additional logic to determine whether a record is subject to the subscription build or not.
Related information:
Automatic Subscription Build
Automatically Building Subscriptions
Subscription Builder Setup Options