How can I pass variables into Subflows from CatalogItem

Felix20
Mega Guru

Hi everybody,

I have a special question, dont know if it works at all, but maybe somebody has a brilliant idea.

Problem:
I workflows, a core workflow and some subworkflows, maybe 2 or 3 layers.

Like that CatalogItem -> Core Workflow -> Subworkflow Layer 1 -> Subworkflow Layer 2

And I want to use activities in Subworkflow Layer 2, which do rest calls ect...
These activities need variables, which should be configurable in CatalogItem.
While ordering a catalogitem from shop, the configured input variables should be passed from catalogitem through core workflow through subworkflow layer 1 to subworkflow layer 2.

This is important, because the persons who will work on workflows are not the same who work on catalogitem (different teams) and the catalogitem guy may just choose an already existing workflow and just want to see, which variables he need to configure (set value of email body for example) without having a look in the script activities in worklfow directly.

That would definitely increase our productivity and reduce error massivly.

I just tried to define a input in subworkflow Layer 2 "MyInput" u_myinput and passed it while calling core workflow. But that u_myinput is not empty in subworkflow Layer 2 because i dont pass it from subworkflow Layer 1 and dont pass it from core workflow.

Does somebody have a brilliant idea how to pass inputs from catalogitem to lowest layer of subflows without passing it from each workflow to an other?

 

many regards

10 REPLIES 10

Is it possible to do some default scripting in the begin node, so that i can read the config for the defined input variable of the current running workflow?

Pranay Tiwari
Kilo Guru

Hi,

Subflows on the Requested Item [sc_req_item] table in the Service Catalog cannot accept variables from parent workflows.

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |

Luiz Lucena
Mega Sage

Having the same situation.

If we cannot pass variables from a parent workflow on the Requested Item table, how should we proceed??

Fabian10
Tera Guru

Hi All,

Even though the docs states:
"Note: Subflows on the Requested Item [sc_req_item] table in the Service Catalog cannot accept variables from parent workflows."

I figured out, that the variables are indeed available in the subworkflow (parent on sc_req_item, sub on sc_req_item). They are available in the workflow.variables object (tested with London). 

To find them, use the following log statement in the subworkflow:

gs.log(JSON.stringify(workflow.variables), 'workflow.variables');

The variables are then available by using the toString() method on the variable attributes, e.g. workflow.variables.myvariable.toString(). If your variable is a reference field, it will have the suffix _reference in the variablename. E.g. workflow.variables.hostname_reference.toString() instead of workflow.variables.hostname.toString().

Other approach: You could also try to let the subworkflow run on global, then you have input variables.

Hope this helps, if so, please mark as helpful and answer.

Best regards,

Fabian

 

Hi,

Nice. I'll have to test this out, I'm on Kingston (just to see if it'll work), but my PDI is also London.

I'll report back what I find.

Thanks for the info!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!