Developers can create actions using apex to handle unique requirements not supported by declarative tools.
To get started:
global interface ActOnItMessageAction {
global ActOnItMessageActionResult execute(
String userId,
String messageLogId,
String messageTypeId,
String messageActionId,
List<Id> relatedRecordIds
);
}
The Apex Class and 'execute' method must use the ‘global’ access modifier to ensure the action is visible to the Act On It framework.
The execute method parameters provide useful context:
Return an ActOnIt.ActOnItMessageActionResult instance to report the results of the action:
global with sharing class ActOnItMessageActionResult {
global Boolean isSuccess;
global String errorMessage;
global String successMessage;
global String navigateToRecordId;
global ActOnItMessageActionResult(Boolean isSuccess, String errorMessage, String successMessage) {
this.isSuccess = isSuccess;
this.errorMessage = errorMessage;
this.successMessage = successMessage;
}
}
Here's an example of a custom apex action class:
global class MyCustomAction implements ActOnIt.ActOnItMessageAction {
global ActOnIt.ActOnItMessageActionResult execute(
String userId,
String messageLogId,
String messageTypeId,
String messageActionId,
List<Id> relatedRecordIds
) {
Boolean isSuccess;
String errorMessage;
String successMessage;
// Execute your custom Apex activity here.
return new ActOnIt.ActOnItMessageActionResult(isSuccess, errorMessage, successMessage);
}
}
Once the Apex class is created, you can begin creating an "Act On It" action that will execute the code when selected by a user.
To create an 'Apex' action, follow these steps:
Configure your action button with the following details:
Lastly, configure your Record Dependency settings and click "Save".
Your Message Action is now ready to be applied to any Message Type with a matching data type. Admins have control over which actions are accessible to users via their User Settings.