Categories

While creating a new workflow, you can use the custom action output as an input for the next action in the workflow. In this case, the output in json could be passed as an input for the next action using 'Dynamic mapping' that will become visible in the workflow once the custom action is added in the workflow. 

So, first of all please create and submit a custom action* that will have json as output. In the example below, the custom action to generate the random password was created and returns the result in json:


$password=

("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=|;':\,./<>?".ToCharArray() | sort {Get-Random})[1..16] -join''

$json= @"
{"RandomPassword":"$password"}
"@

return $json


Then, once the custom action has been added in the workflow, you can map the json output property to a variable you can use in the following workflow steps.


For doing that, just click on the ellipsis button located on the top right hand side of your screen and select "Set Dynamic Mapping":



Then please select "Add dynamic mapping" and you will get the option that allows you to map the output in json from the previous custom action as an input for one of the next actions.


You can select from the Actions drop down menu the custom action name you configured previously, put in the Name field the name of the variable you would like to declare for your workflow and from within the Path name field you should write "response[0].yourjsonproperty" which is in our example RandomPassword:




 After clicking on the 'Save' button located on the bottom right hand side of the screen, you will find the variable declared as an Input variable you can select for any input values of your workflow tasks:



 

* For more information on how to create a new custom action, please refer to the article on how to manage custom actions