The ‘GenerateItem’ action is designed to create dynamic ‘items’ to use elsewhere in a script. Unlike the PickItem action which selects from a predefined list, this action is used for creating things dynamically such as randomised email addresses, passwords or dates.
This type generates whole or part dates and times according to a defined Format. They can be dynamically transformed as per your requirements using plain text phrases in the Transform option.
This can be especially useful for dynamically generating whole or part dates and times for a set period into the future to be used in search fields or URL parameters.
The action type has two options: Format and Transform.
Format
The format dictates how the date will be generated and can be used for producing whole or part dates and times. Format options can be found here. If you wish to enter a character and not have it interpreted into its corresponding format option, then it must be escaped with a backward slash (\).
Y-m-d
– this would produce a date such as “2022-08-27”H:i:s
– this would produce a time such as “10:55:25”Y-m-d H:i:s \(\B\S\T\)
– this would produce a full timestamp including a set timezone in brackets “2022-10-05 09:59:15 (BST)” (note the backward slashes to escape the brackets and timezone characters)Y
– this will simply produce the year such as “2022”
If you require multiple date parts to use separately then you will need to use multiple GenerateItem: Date actions, one per date part.
Transform
This option can be used to dynamically change the date and time returned using a plain text expression. If no Transform option is given then the date and time will default to the server’s current timestamp in UTC.
Some examples of plain text transform expressions:
- “+7 days” – this will produce a date that is +7 days ahead of the server’s current date when the test runs
- “next Monday” – this will produce the date of the next Monday
- “last year” – this will produce the current date, minus one year
- “+1 week 2 days 4 hours 2 seconds” – this will produce the date to the provided Format but exactly 1 week, 2 days, 4 hours and 2 seconds in the future
Note: the date produced will always be relative to the server’s current date and time in UTC when it runs a test of your script.
This example generates a “Y-m-d” formatted date 7 days in the future:

To use the generated item, enter $ScriptVariable.<Name> where <Name> is the name you gave when setting up the action.
The generated string can be input into a text field using either a SendKeys, Form or FormSelector action, dynamically placed in the URL used in an Open action, or in the body of an ApiCall action. Here is an example of it being used in a SendKeys action:

Advanced Usage
Another use for this function would be to add dates to URL parameters. This requires a little more configuration but can be achieved by combining the GenerateItem: Date action with an Open action.
Using the same example as above, we will now insert the generated date variable into a “DynamicLinkPart”. This requires putting a placeholder in the Link option, which will then be swapped for the variable:

Here, the generated date will be entered into a URL query parameter. The myfuturedate
placeholder in the Link field will be replaced with the content of $ScriptVariable.myfuturedate
.
For example, if the generated date 7 days ahead is “2022-10-17” then the URL opened will be “https://www.rapidspike.com/?date=2022-10-17”.
This is useful if you’re testing search functionality that supports query parameters and requires the search to always be in the future relative to the current date.