Actions Management

Introduction

Actions is a very powerful toolbox i Perfion. You can build actions that import, export and transform data in endless ways, and you can set up actions to be executed manually by users, automated by the Perfion scheduler or triggered by various events.

Action structure

An action consists of a series of commands that are executed in sequence. Each command does the following:

  • Recieves input data from an “external” source or from any previous command

  • Transforms input data according to the command itself

  • Delivers ouput data to an “external” source or makes output data available to subsequent commands

 

Example: The action below generates an Excel file based on data in Perfion. It consists of three commands:

image-20240425-085752.png
  • SELECT.PERFION

    • Gets input data from Perfion (via an API query)

    • Transforms data to a generic table format

    • Makes output data available to subsequent commands

  • SELECT

    • Gets input data in generic table format from the SELECT.PERFION command

    • Selects relevant features and transforms feature captions to output specific captions

    • Makes output data available to subsequent commands

  • WRITE.EXCEL

    • Gets input data in generic table format from the SELECT command

    • Transforms data to Excel format

    • Writes data to an Excel file and saves the file to disc

For further information about commands and how to build specific actions, please refer to the Action User Guide.

Access to action management in web client

In the web client, actions are managed via Actions in the main menu. Users need the role Can manage actions in web client to see the menu option:

image-20240419-101613.png

Action library

In the left pane you see a list of existing all actions.

Add new action / organize actions

If you want to add a new action to the library or reorganize existing actions, choose Manage Action from the 3-dot menu:

This opens the Actions library in a grid overlay. In this grid you can add new actions and organize existing actions using normal Perfion grid operations:

Edit action (metadata)

Actions have a predefined metadata structure. You can edit this metadata for all actions in the Manage Actions overlay grid shown above, or you can right-click a single action in the library and choose Open Item:

This opens the action in an item editor where you can manage its metadata:

Each field has a specific purpose:

Base value

Name of the action

Description

For documentation purposes. Not used by the system.

Appearance

This field controls if the action can be executed by users.

If a value is selected in the field, the action is shown in a folder with the same name in the Tools → Execute Actions menu:

Apperance (ActionAppearance) is a normal selectable feature. You must create values yourself in Feature Data.

Job execution

This field controls how the action is executed when users execute it manually in the windows client.

Options are:

  • Local - the windows client executes the action and waits for it to finish

  • Application server - the action is executed server side by the application server

This option has no effect in the web client. Actions are always executed by the application server.

Context feature

This field controls if the action can be executed in context of one or more features.

Actions must be built with a specific struture and logic to work in context of items.

If you select Product in the field, the action can be executed by users in context of Product items:

Context Features (ActionsContextFeatures) is a normal selectable feature. You must create values yourself in Feature Data.

Values must have identical names to the unique names of the features.

Delete action

To delete an action, simply choose Delete Action from the right-click menu. This will delete the action and all its elements.

Copy action

To copy an action, simply choose Copy Action from the right-click menu. This will create an exact copy of the action with the postfix (copy) under the same parent.

Export actions

Actions can be exported to an Excel file. This enables you to import actions under different names or migrate actions between environments.

  • To export individual actions, choose Export Action(s) from the right-click menu.

  • To export all actions, choose Export All Actions from the 3-dot menu.

Both options will open the Export Action(s) dialogue:

File name

Type in the name you want for the exported Excel file

Export with

This option controls which key to use in the Excel file

Names

Action names will be used as keys in the Excel file. This allows you to create new actions in Perfion when reimporting the file. This option is required if you want to migrate actions.

Ids

Action Ids will be used as keys in the Excel file. This only allows you to update elements of existing actions when importing the file.

The exported file looks like this. For details about the file, please refer to article Import / Export Actions.

Import actions

To import actions from an Excel file, simply choose Import Actions from the 3-dot menu.

This will open the Import Actions dialogue:

Select the file you want to import

Click the folder icon and locate the Excel file you want to import

If one or more actions exists in advance

This option controls how the importer behaves if the import file contains actions that exist in advance.

Stop import

Importer will stop if the Excel file contains one or more existing actions.

NOTE: This option only works when Names are used as keys in the Excel file.

Skip existing actions but import new

Importer will ignore existing actions in the Excel file but import new actions.

NOTE: This option only works when Names are used as keys in the Excel file.

Replace existing actions and import new

Importer will import all actions in the Excel file. New actions will be created, and existing actions will be replaced by actions in Excel file.

Action elements

When you click an action in the library, you will see the structure and the elements of the action in the right pane.

Groups

A group is a collection of action commands and/or other groups. Groups exist only to provide structure and overview. Groups have no technical function when actions are executed.

Add a group

Click + Group the the toolbar to add a group.

The new group will be added as the last element in the action. Click the pencil icon to write a descriptive name for the group:

Add a group in context

Right-click any existing element and choose Add Group to add a group in context.

  • If an existing group was right-clicked, the new group will be added as a child to the clicked group.

  • If an existing command was right-clicked, the new group will be added as a sibling to the clicked command.

Organize groups

You can organize groups by dragging them by the 6-dot handle and dropping them to new positions:

  • Drop group between existing groups to reorder groups at the same level

  • Drop group inside another expanded group between existing elements to make group a subgroup (specific order)

  • Drop group on top of another collapsed group to make group a subgroup (last element in group)

Copy group

Choose Copy from the right-click menu to copy a group. All elements inside the group will be copied with the group.

Move group to other action

Choose Move to other Action from the right-click menu to move a group and all its elements to another action.

This opens a selector where you choose the target action. The moved group will be placed as the first element in the target action.

Ignore group

Click the Ignore checkbox if you want the action to ignore the group and all its elements.

Delete group

Choose Delete from the right-click menu to delete a group. All elements inside the group will be deleted with the group.

Commands

Commands are the actual building blocks of the action. When an actions is executed, all commands are executed in the order they appear in the action.

Add a command

Click + Command in the toolbar to add a group.

This opens a new window where you select the command you need:

The new command will be added as the last element in the action.

Command properties

Click the arrow button to expand the command. You can now customize the command properties found in the top section.

Pencil icon

Write a short description that explains what the command does

Ignore checkbox

Check this box if you want the action to ignore the command

Settings icon

This icon opens a windows where you can choose what happens if the command fails

Stop (default)

The action will stop if the command throws an error.

Proceed

The action will proceed if the command throws an error.

Execute action and proceed

Select an error handling action in the selector to be executed if the command throws an error. After the error handling action is executed, the action will proceed with next command.

Execute action and stop

Select an error handling action in the selector to be executed if the command throws an error. After the error handling action is executed, the action will stop.

Action to execute

This option is only available for commands EXECUTE.ACTION and EXECUTE.ACTION.LOOP. When one of these commands are selected, you can choose an action the command must execute:

From

Name of the Input Data Source.

To

Name of the Output Data Source.

Script

Script code that may be executed by the Command. Not all commands use scripts.

Note

You can use this to supporting information and to document the command.

Command parameters

Parameters are sub-ordinates to the command. Parameters controls the specific behaviour of the command. Each command has a different set of parameters.

Add parameter

Click the green + icon to add a parameter. A new row will be added where the first available parameter is selected. Change to the parameter you need.

Remove parameter

Check this red x icon to remove a parameter.

Sort parameters

Drag a parameter by the 6-dot handle to move it to a different position (relative to other parameters for the same command).

Value

The content of the Value field relates to the selected parameter.

Script

Script code that may be used by the parameter. Most parameters don’t use scripts.

Note

You can use this to supporting information and to document the parameter.

Ignore

Check this box of you want individual parameters to be ignored when the action is executed.

Command mappings

Mappings (also known as Value Mappings) are sub-ordinates to the command. With mappings you can convert input header names to output specific header names and transform values (via scripts).

Add mapping

Click the green + icon to add a mapping.

Remove mapping

Check this red x icon to remove a mapping.

Sort mappings

Drag a mapping by the 6-dot handle to move it to a different position (relative to other mappings for the same command).

From

Name of Header, as it is named from Input-source.
If *** is specified this will take all columns, that are not specified by any of the other mappings.

To

Name of the Header as it should be called in the Output-source.

Script

Any Script code to execute for this header

Note

You can use this to supporting information and to document the mapping.

Ignore

Check this box of you want individual mapping to be ignored when the action is executed.

Organize commands

You can organize commands by dragging them by the 6-dot handle and dropping them to new positions. Commands can be dropped inside groups or at the same level as groups.

Copy command

Choose Copy from the right-click menu to copy a command. The new command is placed below the original.

Move command to other action

Choose Move to other Action from the right-click menu to move a command to another action.

This opens a selector where you choose the target action. The moved command will be placed as the first element in the target action.

Ignore command

Click the Ignore checkbox if you want the action to ignore the command.

Delete command

Choose Delete from the right-click menu to delete a command.

Execute actions

As mentioned in the introduction to this article, actions can be executed in a number of different ways. These are explained below.

Execution by administrators in Actions

Actions can be executed directly via the Action icon in the toolbar. This is mostly used to test actions while they are built or updated:

Actions are executed by the application server. You can follow the progress and see if the action failed or succeded in the Job window:

Execution by users

Users can execute actions from the Tools menu in the main menu:

Two conditions must be true for users to execute actions:

  • Users must have the role Can execute actions.

  • Each action must be “approved” for user execution. This is done by assigning the action a value in the Appearance feature (please see section Edit Action (metadata) for details).

Execution by users in context of items

Actions can be executed in context of other items. This enables users to execute an action that does “something” to the selected items only (or to all items in grid):

Two conditions must be true for users to execute actions in context of items:

  • Users must have the role Can execute actions.

  • Each action must be “approved” for user execution in context of specific base features. This is done by assigning the action values in the Context feature (please see section Edit Action (metadata) for details).

Execution via Triggers

Ac action can be executed via a trigger. Please refer to the article Item Triggers for more information.

Execution via Scheduler

An Action can be scheduled to be executed at certain points in time. This is done with the Perfion Scheduler. Please refer to the article Perfion Scheduler for more information.

Execution via Perfion API

An Action can be executed by an API call. Please refer to the article Perfion Execute Action Query for more information.