Override Supported Subscription Actions
When a Subscription is selected in the Manage Subscriptions flow, the master flow returns a list of available action, based on the subscription's attributes.
Since this is calculated in apex, the logic can be replaced with any other logic that more accurately returns the list of available actions, based on additional attributes.
The apex class must return the type
List<i42as.PicklistChoice>
The PicklistChoice apex class has a constructor with 2 String parameters, action label and action name.
While action label can be anything, action name must be one of the following 8 supported types:
remove
switch
refund
renew
change_payment
change_address
pause_print
redeem_giftAn example for a class returning the above actions is the following:
@InvocableMethod
global static List<List<i42as.PicklistChoice>> getActions() {
List<i42as.PicklistChoice> actions = new List<i42as.PicklistChoice>();
actions.add(new PicklistChoice('Cancel','remove'));
actions.add(new PicklistChoice('Switch','switch'));
actions.add(new PicklistChoice('Renew','renew'));
actions.add(new PicklistChoice('Refund','refund'));
actions.add(new PicklistChoice('Change Payment','change_payment'));
actions.add(new PicklistChoice('Change Address','change_address'));
actions.add(new PicklistChoice('Pause Print','pause_print'));
actions.add(new PicklistChoice('Redeem a gift','redeem_gift'));
return new List<List<i42as.PicklistChoice>>{actions};
}Each available action can be returned and filtered based on a number of relevant attributes, to better tailor the list of relevant actions per individual subscription record, to prevent agents from selecting an action that isn't relevant in the specific context. To refine this further, the logic could take into account not only the current subscription, but also a combination of everything else in context, such as the case this is raised for, the customer, and the Salesforce user performing the action (for example, by looking at its profile/role, or assigned permission set).
The full list of subscription attributes and what they contain is described here: .
Existing logic for surfacing actions
The current apex class included in the managed package perform the following logic to determine whether to show each action:
Cancel:
subscription.endDateis in the futureit is not a gift
Switch:
subscription.statusis notCancelledit is not a gift
Renew:
subscription.isAutoRenewableisfalsesubscription.statusis notLapsedit is not a gift
Refund:
subscription.statusis eitherCancelledorActiveorLapsedit is a refundable gift
Change payment:
subscription.statusis notCancelledit is not a gift
Change Address:
subscription.endDateis in the futureit is not a gift
Pause print: requires customisation
Redeem a git: requires customisation
Credit Memo: requires Limio for Salesforce v12.18 or later
subscription.statusis eitherCancelledorActiveorLapsedallowCreditMemoActionconfig is set to true, learn more about the config here:
Tips
1. How to verify that a subscription will end in the future?
sub.endDate == null || Date.today() <= sub.endDate
2. How to verify that a subscription is not a gift?
sub.isGift == null || sub.isGift == false
3. How to verify that subscription is a refundable gift?
sub.isGift == true && sub.isGiftRefundable == true
Last updated
Was this helpful?

