Release Preview
v67.0
An asset represents a product or service that a customer has purchased. Lifecycle-managed assets show information from the initial sale of a subscription through its end date, including any cancellations, quantity changes, or renewals. Use lifecycle-managed assets for an up-to-date view of your customer's purchases and your monthly recurring revenue.
To learn more about lifecycle-managed assets, see Understand What Your Customers Have Bought by Viewing Lifecycle-Managed Assets in Subscription Management.
To learn more about using these endpoints to build a solution, see Examples.
Understanding Asset-to-Order Asynchronous Processes
The following endpoints use information from the provided assets to create a change order, such as a cancellation order, a renewal order, or a quantity amendment order.
- /asset-management/assets/collection/actions/initiate-cancellation
- /asset-management/assets/collection/actions/initiate-renewal
- /asset-management/assets/collection/actions/initiate-amend-quantity
To enable performance at high scale, each request initiates an asynchronous process and returns before processing is complete. When the process completes, it publishes an event containing status information and the ID of the change order.
Response Parameters
The asset-to-order endpoints return the following response parameters.
requestIdentifier- an ID that uniquely identifies the request. Use this ID to match the event to the specific request, and to query for any associated RevenueTransactionErrorLog records. See Errors.statusURL- a link to the RevenueAsyncOperation record created by the request. You can query this record to poll for updates on the status of the asynchronous process. For example,
SELECT Status FROM RevenueAsynOperation WHERE ID = '<RevenueAsyncOperationId>'
Errors
Any errors that occur during the asynchronous process are stored in RevenueTransactionErrorLog records. Use the requestIdentifier from the response to select every error log associated with the request. The PrimaryRecordId is the ID of the asset that caused the error. For example:
SELECT PrimaryRecordId, ErrorMessage from RevenueTransactionErrorLog where RequestIdentifier ='<requestIdentifier>'
If a child asset causes an error, the resulting error log record is related to the child asset's parent asset. The error log record's Related field contains the ID of the asset that caused the error. For example, suppose that you have a bundled asset with three nested levels. If an error occurs when processing the asset at the third level, the error log record is related to the asset at the second level.
Platform Events
To retrieve the ID of the amendment order, subscribe to the platform event published by the asynchronous process. Use the requestIdentifier from the response to select the event corresponding to the request. For example, the following shows one way that you could subscribe to the AssetAmendInitiatedEvent:
// Trigger for AssetAmendInitiatedEvent (other asset events are similar)
trigger AssetAmendInitiatedEventTrigger on AssetAmendInitiatedEvent(after insert) {
// Iterate through each notification.
Map<String, String> errors = new Map<String, String>();
Set<Id> orderIds = new Set<Id>();
for (AssetAmendInitiatedEvent event : Trigger.New) {
String requestId = event.RequestIdentifier;
if (!event.HasErrors) {
// ID of the amendment order, quote, or other object.
Id recordId = event.AmendmentRecordId;
String objType = recordId.getSObjectType().getDescribe().getName();
if (objType == 'Order') {
orderIds.add(recordId);
}
} else {
// get the errors from the RTEL
//SELECT PrimaryRecordId, ErrorMessage from RevenueTransactionErrorLog where RequestIdentifier ='<value of requestIdentifier>'
}
}
Locking
While the asynchronous process is executing, the related assets are locked so that another request can't change their data. After the process completes, the assets are unlocked.
Post Processing
If the Create Billing Schedule and Asset flow is activated in your org, the assets and billing schedules are also updated to reflect the changes from the change order. These invocable actions are called by the flow:
/actions/standard/createOrUpdateAssetFromOrderupdates the asset records with the amendment information./actions/standard/createBillingScheduleFromOrderItemupdates the billing schedules with the amendment information.
Let us know so we can improve!