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.

mceclip0.png

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_gift

An 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.endDate is in the future

    • it is not a gift

  • Switch:

    • subscription.status is not Cancelled

    • it is not a gift

  • Renew:

    • subscription.isAutoRenewable is false

    • subscription.status is not Lapsed

    • it is not a gift

  • Refund:

    • subscription.status is either Cancelled or Active or Lapsed

    • it is a refundable gift

  • Change payment:

    • subscription.status is not Cancelled

    • it is not a gift

  • Change Address:

    • subscription.endDate is in the future

    • it is not a gift

  • Pause print: requires customisation

  • Redeem a git: requires customisation

  • Credit Memo: requires Limio for Salesforce v12.18 or later

    • subscription.status is either Cancelled or Active or Lapsed

    • allowCreditMemoAction config 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?