Services Credits Apex Actions
You can implement customizations to allocate and expire services credits automatically. You can do this programmatically via the API, or you can do it without writing code by invoking either of the following Apex actions from a Salesforce flow.
| Category | Apex Action | Apex Class | Purpose |
|---|---|---|---|
| Services Credits | Allocate Services Credits to Milestones | ServiceCrdtsServiceActionAllocCredsForMS | Allocates services credits to milestones when milestone IDs are valid. This method returns allocation IDs. If any of the records are invalid, the allocation process fails for all the records. |
| Services Credits | Expire Services Credits Customer Purchases | ServiceCreditsServcActionExpirePurchases | Expires available services credits that remain on services credits customer purchase records where the expiry date is in the past. For each purchase ID, a result object is returned. If the expiry process is successful, the result object contains the newly created allocation ID. For any records that could not be expired, the result object contains an error message. |
Inputs and Outputs for the Allocate Services Credits to Milestones Apex Action
Input Parameters
The Allocate Services Credits to Milestones Apex action has the following input parameters for each milestone passed to it.
| Parameter | Required or Optional | Description |
|---|---|---|
| Milestone IDs | Required | The list of milestone IDs to allocate services credits to. |
Output Parameters
The Allocate Services Credits to Milestones Apex action has the following output parameters for each milestone passed to it.
| Parameter | Description |
|---|---|
| Allocation IDs | The list of the services credits allocation records IDs that were created. |
Inputs and Outputs for the Expire Services Credits Customer Purchases Apex Action
Input Parameters
The Expire Services Credits Customer Purchases Apex action has the following input parameters for each purchase passed to it.
| Parameter | Required or Optional | Description |
|---|---|---|
| Purchase IDs | Required | The list of IDs of services credits customer purchase records with available credits to expire. |
Output Parameters
The Expire Services Credits Customer Purchases Apex action has the following output parameters for each purchase ID passed to it.
| Parameter | Description |
|---|---|
| Expiry Result | The list of results after expiry. The result contains purchase ID, the services credits allocation record ID if one was created, or an error message if an error occurred. |
SECTIONS