With the help of this callback class, you can append custom filters to the on-demand asset query when the asset line items are fetched from the on-demand renewal quote. For example, you can filter assets byProduct Nameas a filter criteria.
To use the Asset Renewal Custom Callback, you must create a custom C# class that implements theIAssetRenewalCustomCallbackinterface and register the custom C# class with Asset Renewal Custom Callback Class. You must write your custom logic in the custom C# class.
The following methods are available in theIAssetRenewalCustomCallbackinterface:
Method
Signature
Description
GetFilterExpression
string GetFilterExpression()
You must use this method to append custom filters to the on-demand asset query when the asset line items are fetched from the on-demand renewal quote. If there are no additional filters (other than the standard filters), return null.
The following is an example of the custom logic you can implement using asset filter example.
Example
using Conga.Platform.Extensibility.Callback;
using Conga.Platform.Extensibility.Callback.Interfaces;
using Conga.Platform.Telemetry.Contracts;
using Conga.Revenue.Common.Callback;
namespace Conga.Revenue.Callbacks
{
/// <summary>
/// Asset renewal callback class
/// </summary>
public class AssetRenewalCallback : CallbackBase, IAssetRenewalCallback
{
/// <summary>
/// Constructor for AssetRenewalCallback
/// </summary>
/// <param name="callbackExecutor"></param>
/// <param name="tracer"></param>
public AssetRenewalCallback(ICallbackExecutor callbackExecutor, ITelemetryTracer tracer) : base(callbackExecutor, tracer) { }
/// <summary>
/// Write custom code for implementing a filter logic to retreive assets in renewal flow
/// </summary>
/// <returns> conditions to filter asset lines</returns>
public async Task<string> GetFilterExpression()
{
using var span = tracer.StartActiveSpan($"{nameof(IAssetRenewalCallback)}.{nameof(this.GetFilterExpression)}");
return await callbackExecutor.ExecuteCallbackAsync<IAssetRenewalCallback, string>(moduleName, nameof(GetFilterExpression), span?.TraceId);
}
}
}