Remove item list rows
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.
Configuration
The configuration of the SDK action is simple, after uploading the plugin:
- Choose the
Run an SDK action
- Select the
RemoveItemListRows
action from the plugin
Open the configuration and:
- Select the item list id
- Define the column name which contains the DET_ID
- Provide the SQL command which will return the ids of the rows which should be removed
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.
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.
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.
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