The "Set Data List" step type is a feature within form actions that allows users to update records in a data list through form operations automatically. This step updates specific field values in the data list when a user submits a form, facilitating automated management of business processes.
When to use the "Set Data List" step?
The "Set Data List" step is applicable in the following scenarios:
Automatic Data Updates: Automatically modify or update relevant records in the database upon form submission or update.
Data Interlinking: Update or modify data records in other lists simultaneously with the current form operation.
Data Creation or Deletion: Create new records or delete records based on specified conditions through the form.
Note: The "Set Data List" step is suitable for various form types, including list forms, approval forms, and dashboards.
How to use the "Set Data List" step?
1. Execution Conditions
In this step, you can set execution conditions to control whether the step is executed. You can also check the box for "Continue next step when condition is not met" to ensure that the entire process does not terminate when conditions are not satisfied. For more details on execution conditions, please refer to the execution conditions of actions.
2. The current list and Select a data list
The current list: When you select "The current list," the system will operate on the current data record in the form. Click the βField settingsβ button to configure the list fields and values for the current list.
To set the values for list fields, check the box before the field. Then, use the expression editor in the value column to set the values. You can set static values from the top text area or choose dynamic values from list fields, contexts, temporary variables, etc. After setting the field-value mapping, click the "OK" button to close this dialog.
Select a data list: When you select "Select a data list," you can operate on records in other data lists. At this point, the data source can be a data list or a document library.
Note: "The current list" option is only applicable to list forms. The "Select a data list" option is applicable to list forms, approval forms, and dashboards.
3. Execute Type Selection
After selecting the data source, you need to choose the specific execute type, with options including Add, Update, and Delete.
Add: Creates a new record in the selected data list.
Click the "Field Settings" button after selecting 'Add 'to open the Field Settings dialog. The first column displays all fields in the selected data list, the second column shows the type of each field, and the third column is where you set values for each list field. To set field values, check the box in front of each field, and then use the expression editor in the value column to set the value.
Update: Updates one or more records in the selected data list. Click the "Field Settings" button, select the fields you want to update, and set values in the same way as when adding records.
The main difference between adding and updating records is the filter condition. When updating records, you need to set conditions to locate the records you want to update.
Example: Update a project when both Project ID and Owner meet certain conditions.
When performing an update, all records that meet the predefined conditions will be updated.
Note: If no conditions are set here, all records in the target data list will be updated.
Delete: Choose this option if you want to delete records from the selected data list. When deleting records, you need to set appropriate conditions. The workflow will search for and delete records in the data list based on these conditions.
Note: If no conditions are set here, all records in the target data list will be deleted.
4. Execute Result
This option is applicable only to list forms:
Return Status Code: When operating on the data table, the system will return a status code to indicate the success or failure of the operation. You can design subsequent operation logic based on this status code, such as displaying different prompt messages or executing different steps depending on the status code.
Save the Number of Results to a Variable: In list forms, you can save the number of results generated by the operation into a variable for processing or display in subsequent steps. This feature is commonly used to track the number of records affected by an operation, facilitating subsequent related actions.
With these settings, you can flexibly operate on data in forms or records in external lists using the "Set Data List" step type, achieving automated management of the linkage between forms and data tables.