1. Tasks
  2. Set List

Tasks

Set List

Sets a list of values to a stub data key
You can set, add or remove items to/from an array data key in stub data.

Items need to be with a JSON array or a string with delimeted strings. A delimiter parameter is required if you wish you use a delimeted string.

You can also add items using data substitution.

Basic usage

loading...

Parameters

fieldname

required
string
This is the fieldname to which the list will be writting to in stub.data


set_items

optional
array

Use this param as an array to set the contents of the list [fieldname]. Anything that was in the list will be replced.

add_items

optional
array

Use this param as an array of items to be added to the contents of the list [fieldname]

remove_items

optional
array

Use this param as an array of items to have removed from the contents of the list [fieldname]

INFO

At least on of the following is required:

  • set_items
  • add_items
  • remove_items

delimiter

optional
string

Required if your set_items, add_items, remove_items parameter is a string of items that are delimeted by specific character.

Specify the delimer character in this parameter.

Result

loading...

Properties

payload.fieldname

The data key to which the list was written to in stub.data

payload.items

The data that is was stored into the [fieldname] data key

Examples

These are some more complex examples

Add items to a list

Existing Data
loading...
Task
loading...
Result
loading...

Remove Item from list

write something about this example here

Existing Data
loading...
Task
loading...
Result
loading...

Setting the Contents of the list from a Delimeted String

loading...
Result
loading...

Using Substituted data in lists

You can add, remove or set list data using substituted data.

The data key used in add_items, remove_items & set_items should reference a JSON array.

Existing Data
loading...
Task
loading...
Result
loading...