Using the same variable on multiple workflows


I am looking to use some variables in a different workflow, I think i can do this by using arguments but am not sure what to type into the argument.

Can someone help me?

You’re right. Variables can be passed between workflows using arguments by setting:

1.) The name of the argument - This is the name of the variable within the workflow you’re passing the original variable to.
2.) The type of the argument - This is the datatype, so if you’re passing a String, this is a System.String type, for example.
3.) The direction of the argument - One of 3 choices: In, Out, or In/Out. In lets you pass a variable without it changing outside of the workflow you’ve passed it to. Out is used to get a variable from the workflow, rather than pass one in. In/Out is used to do both. The variable is passed to the workflow, and if it changes in that workflow, it will change outside of the workflow as well.

1 Like

do i write the argument on the workflow the variable is created or on the workflow it is being passed on to? @Anthony_Humphries

this is currently on the workflow the variables have been created on

You’ll send the variable where the variable is created, but the workflow must be created with its arguments already defined. Your screenshot shows what these arguments look like within the workflow. These will remain the same. It’s only when you call the workflow that you’ll pass the variable.

1 Like


I have created the variables in the workflow as below

on the workflow that i passing the variable on to i still have loads of errors

You only have 2 arguments, so if there are a lot of errors, they likely don’t relate to the issue of passing the variable. Can you share the workflow-related errors in the main project?

the errors in the main workflow say - ‘spreadsheetID has not been declared’ and its the same for the other variable.

Check the scope of the variable. It may be that it was created earlier, but needs to be accessible to a larger part of your main workflow.

there is only an option to choose the workflow the variable has been created in, i don’t have the option in selected the main workflow that i want to pass the variable onto. @Anthony_Humphries

The scope is defined where you defined the variable. Try raising it to the highest level possible (i.e. the name of your main workflow’s sequence, and see if that fixes it.

in the arguments in the main workflow i want to pass on the variables to i changed the direction to in with the same variable same all errors have disappeared. Thanks for you help @Anthony_Humphries