> For the complete documentation index, see [llms.txt](https://docs.limio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.limio.com/integrations/setting-up-limio-for-salesforce/subscription-actions-rules/override-subscription-actions.md).

# 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.<br>

<figure><img src="/files/zgFpqH0Anvj5CIJTAorE" alt=""><figcaption></figcaption></figure>

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: [SubscriptionRefined Apex Class](/integrations/setting-up-limio-for-salesforce/apex-classes/apex-subscriptionrefined.md).

## 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: [Subflow: Credit Memo](/integrations/using-limio-for-salesforce/manage-subscriptions-flow/subflow-credit-memo.md)

### 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`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.limio.com/integrations/setting-up-limio-for-salesforce/subscription-actions-rules/override-subscription-actions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
