Referencing a local variable in a workflow in a script | Community
Skip to main content
August 24, 2022
Solved

Referencing a local variable in a workflow in a script

  • August 24, 2022
  • 1 reply
  • 820 views

Hi,
I am wondering if it is possible to call a local variable created within a workflow inside a script to create a condition. I know that a script can reference an attribute from a data schema and recognize its value, which you can use to create a condition, but am not sure if the workflow will function the same if it was a local variable that was created under its properties. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manoj_Kumar

Hello @ryanng1 

 

You can define a variable by vars.VARIABLE_NAME command and then use it anywhere in your WF.

1 reply

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
August 24, 2022

Hello @ryanng1 

 

You can define a variable by vars.VARIABLE_NAME command and then use it anywhere in your WF.

Manoj  | https://themartech.pro
ALangridge
Level 4
August 25, 2022

Just a lil addition - if you want to use the variable within a split or something like that, you'd just have to use the following syntax in the expression editor: 

 

 

$ - This is a string type value to be returned from the variable
() - The info we are looking for
vars - We’re looking at an event variable
/@{name} - The variable

The above info is for a event variable - if you wanted to access an instance variable, you’d just look at something like $(instance/vars/@variable)

If you want the returned variable to be in a different format, you’d change the $ to:

$long

$float

$boolean

$datetime


I'm referencing largely the top of this campaign standard page, but it works the same in Classic from my testing (please let me know if I'm wrong) :  
https://experienceleague.adobe.com/docs/campaign-standard/using/managing-processes-and-data/calling-workflow-external-parameters/customizing-workflow-external-parameters.html?lang=en