2 minute read BPS Version: 2022.1.2.31

Overview

This post describes the configuration of a custom action which can be used to remove defined rows from an item list. This is not possible with the provided actions. The change list item action supports:

  • adding new rows
  • updating existing rows, which can also be used to add new rows
  • replacing the existing rows, this will delete all rows and add new ones.

You can use the Replace values option to remove rows. There are two drawbacks. The first one is, that it’s not so easy to identify the removed rows in the version history. The second one depends on the use case. If you are referencing item list rows in other workflows, these references will be break.

Using the custom SDK action will only remove the defined ones, the other rows won`t be changed. So it will be easier to identify the changes in the history.

How the changes of the different actions are displayed in the history.
How the changes of the different actions are displayed in the history.

Configuration

The configuration of the SDK action is simple, after uploading the plugin:

  1. Choose the Run an SDK action
  2. Select the RemoveItemListRows action from the plugin
Selecting the action
Selecting the action

Open the configuration and:

  1. Select the item list id
  2. Define the column name which contains the DET_ID
  3. Provide the SQL command which will return the ids of the rows which should be removed
RemoveItemList configuration
RemoveItemList configuration

Example SQL command which will return all item list rows which column value is true.

select DET_ID
from WFElementDetails 
where DET_WFCONID = {WFCON:2160}
 and DET_WFDID = {WFD_ID} 
 and {DCNCOL:323} = 1

Info: There’s no option to test the SQL command, therefore create the script in another action or data source.

SDK Action execution

The action will execute the SQL command against the current database. In case the SQL command fails, you can take a look at the history in admin mode to see the execute SQL command.

Log example when there's an error in the SQL command.
Log example when there’s an error in the SQL command.

It will also be checked whether the selected item list exists and if the result of the SQL command contains the column containing the DET_ID.

Log example when the column name doesn't exist in the result.
Log example when the column name doesn’t exist in the result.

If everything is fine, the rows will be removed. Which rows have been removed can be seen in the log, if you switched to admin mode.

The list of the removed rows.
The list of the removed rows.

Download

The repository of the custom SDK action can be found here.
If you don’t want to build it yourself, you can download the .zip here.

Comments