Run An Apex Class action

DAP actions

Last published at: June 13th, 2023
Delete

The Run An Apex Class action is available for Premium and PDM licenses.

Delete

This article is about running an Apex Class as a DAP Action. For starting a DAP Action from an Apex Class, see Start an Action from an Apex Class‍.

Use the Run An Apex Class action to execute your Apex Classes as a DAP action. By running apex classes as an action, you can:

  • Apply an apex class to multiple records in one go; in a job or from list view. 
  • Let you end users execute an apex class, dependent on their action assignment settings. No need for an administrator to execute the apex class! 
  • Monitor the flow executions in the Audit Log.
  • Add custom actions to the Action Launcher, by creating a Macro based on an apex class action.

But most importantly, by using an Apex Class, you can basically create your own DAP actions! The possibilities are endless. Develop your own action, and put it to work by utilizing Data Action Platform features such as batch processing, scheduling, filtering and much more.

Prerequisites

To set up and use a Run An Apex Class action, you need:

  • The Apex Class you want to run. Apex classes need to adhere to some requirements to be suitable for use in a DAP action. Find out how to create an apex class for DAP in Creating your own actions with Apex Classes‍.
Delete

Permissions

When a user or profile is allowed to run the Run An Apex Class action according to the action assignment in the Action Library in DAP Setup, they can run all apex classes that are suitable for use in a DAP action. To restrict user or profile access, either 

  • Create a Macro‍ based on the Run an Apex Class action, that runs a specific apex class. In the Action Library in DAP Setup, only assign the user or profile access to that specific Macro, not to the Run An Apex Class action. Or:
  • Add a method in the Apex Class that manages access to the class. This is explained in Creating your own actions with Apex Classes.

Run an apex class as an action

  1. Select the records that you want to apply the apex class to in a list view, or by creating a new job.
  2. In the Action Launcher (top right in list view, or the next window in the DAP Job modal), select Run an Apex Class and click Next.
  3. Select the Apex Class you want to use. In the select list, only Apex Classes that are suitable for use in a DAP action are shown. See Creating your own actions with Apex Classes‍ to find out how to create an Apex Class for DAP.
  4. If enabled, change the Chunk Size to fit the needs of the flow (available for DAP Job and Macros)
  5. Click Next > Start.

The Apex Class is now applied to all selected records. You can check the results in the Audit Log‍.

Delete

Settings for the Run an Apex Class action

Settings for the Run an Apex Class action, such as the default Chunk Size‍, or the option to let end users change the chunk size, can be set in DAP Setup > Action Library > Run an Apex Class: Edit