Using the API or Apex Actions to Generate Recognition Schedules

If you want recognition schedules to be generated automatically when source records are created, edited, or deleted, you can call the Revenue Management API from your own custom code, or invoke Apex Actions from record-triggered flows.

Using the Revenue Management API

For technical information about the following API services, see the Revenue Management API Developer Reference which is listed in Permission Sets and Other Technical Documentation.

RevenueSchedulesService

The following generate or synchronize methods are available:

  • RevenueSchedulesService.generate runs synchronously
  • RevenueSchedulesService.generateAsync runs asynchronously
  • RevenueSchedulesService.synchronize runs synchronously

The difference between generate and synchronize is that in addition to generating recognition schedules, synchronize also removes obsolete recognition schedules by deleting any where the source record is unavailable. A source record is unavailable if it has been deleted, is no longer active for recognition, or its recognition template has been removed.

See Synchronous and Asynchronous Recognition Schedule Generation for information about how error handling differs depending on whether the process runs synchronously or asynchronously.

RevenueScheduleAutomationService

The RevenueScheduleAutomationService is a global API that allows you to automate the end-to-end process for recognizing revenue and cost against recognition schedules, from generating the schedules through to creating Accounting journals. For more information, see End-to-End Automation of Recognition Schedule Processes.

RevenueContractService

If you use the RevenueContractService.create method to create revenue contracts, note that recognition schedules are generated automatically for the revenue contracts. This automatic creation of recognition schedules can be disabled by selecting the Disable Generate Schedules for Contracts field in the Revenue Management Settings custom setting.

Using Apex Actions

You can use Process Builder to configure record-triggered flows to call the following Apex actions which run synchronously:

Apex Action

Description

Generate Recognition Schedules from source records

Generates recognition schedules for a source record that is created or updated.

We recommend your flow is configured so that the action runs only when a source record is available for recognition i.e. it has a recognition template and is marked as active for recognition.

Delete Recognition Schedules

Deletes recognition schedules associated with a source record.

Typically a flow will be configured to trigger this action when a source record is deleted.

If the source record being deleted has "Complete" recognition schedule lines, those lines are not deleted and the recognition schedule's status is set to "Source Unavailable".

For an example, see Configuring a Salesforce Flow to Delete Recognition Schedules When a Source Record Is Deleted.

Synchronize Recognition Schedules from source records

Synchronizes recognition schedules with their associated source record. This includes creating recognition schedules if none exist for a source record, updating recognition schedules if the source record has changed, and removing obsolete recognition schedules if the source record is unavailable. A source record is unavailable if it has been deleted, is no longer active for recognition, or its recognition template has been removed.

If there are "Complete" recognition schedule lines associated with a source record that is unavailable, those lines are not deleted and the recognition schedule's status is set to "Source Unavailable".

For an example, see Configuring a Salesforce Flow to Synchronize Recognition Schedules When a Source Record Is Created or Updated.

Warning:

Record-triggered flows are not triggered when:

  • A formula field on a source record changes.
  • A source record changes as a result of changes to its parent.

The source record itself must be created, edited, or deleted for flows to be triggered. Refer to the Salesforce Help for more information about flows and how to create them.