Posted Fri, 22 Mar 2019 08:35:39 GMT by

If I want to use a shared variable that I created in a workflow inside a task, I use %Varaibalename% inside the task.  If I am working on the task and developing it, do I have to create a variable in the task with the same name and once happy, delete it so that it uses the shared variable when run from the workflow or is there a better way of doing this?

The problem I see with this, is if someone wants to change the task then they have to create the local variables again before they can work with the task.

P.S. I'm new to Automate.

Posted Fri, 22 Mar 2019 19:57:08 GMT by

Here's typically what I do.  When I'm building a task, I define all the variables that will be shared with "Create Variable".  When the task is completed, I disable the "Create Variable" steps corresponding to variables that will be shared.  There is an exception.  If the variable is "optional", meaning that I want the task to treat a variable as having a default value, but allow the workflow to override it (useful when you re-use the same task in multiple workflows, but want to alter behavior slightly), then I will leave the variable declaration in the task with that default value, and use the "Treat as Parameter" option.  If the variable is not optional, then I disable that variable's "Create Variable" step so that the task throws an error if the shared variable isn't defined.

Hope this helps.

Posted Sat, 23 Mar 2019 07:50:31 GMT by

Thanks David. That's exactly what I was going to suggest.

You must be signed in to post in this forum.