Expand my Community achievements bar.

SOLVED

How to fetch the value for instance variables in a JS activity?

Avatar

Level 2

Hi All,

 

I would like to fetch the instance variable of workflow A in a JS activity in workflow B.

Anushka_RK_0-1709066618249.png

 

I have written the following code:

var workflowContent = xtk.queryDef.create(
<queryDef schema="xtk:workflow" operation="select">
<select>
  <node expr="variables" alias="VariablesTab"/>        
</select>
<where>
  <condition expr = {"@internalName = 'WKF123'"} />
</where>
</queryDef>).ExecuteQuery(); 
logInfo("XML: "+workflowContent);

for each(var row in workflowContent) 
{
  var wkfVariablesTab = row.VariablesTab;
  logInfo("Variables: "+wkfVariablesTab);
}

 

logInfo("XML: "+workflowContent); populates the following result:

XML: <workflow-collection> <workflow>
<VariablesTab running="false" running-type="boolean"/>
</workflow> </workflow-collection>

 

However, wkfVariablesTab variable is empty. How can I retrieve the instance variable running ="false" running-type="boolean" in the wkfVariablesTab variable?

 

Kind Regards,

Anushka RK

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Anushka_RK 

 

instance variables are not stored and that is why you can get them by querying schema.

If you want  a value want it in workflow B, then there are 2 ways to do it.

  1. Pass the instance variable value to workflow B by using external signal activity. I am not sure if you are using external trigger for Workflow B
  2. Use Option instead of variables

 


     Manoj
     Find me on LinkedIn

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello @Anushka_RK 

 

instance variables are not stored and that is why you can get them by querying schema.

If you want  a value want it in workflow B, then there are 2 ways to do it.

  1. Pass the instance variable value to workflow B by using external signal activity. I am not sure if you are using external trigger for Workflow B
  2. Use Option instead of variables

 


     Manoj
     Find me on LinkedIn