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

Allen Andreas
Administrator
Administrator

Hi,

Please see this documentation on how to pass a variable from a workflow to a subflow:

https://docs.servicenow.com/bundle/london-servicenow-platform/page/administer/workflow-activities/ta...

Please mark reply as Helpful/Correct, if applicable. Thanks!


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

Hi allen, this is not what i want to do.

Hi,

You mentioned in your post catalog item, so without assuming you were talking about a RITM...I gave relevant documentation to assist you. Catalog item can be numerous things.

If the workflow is on the RITM table, then it is not possible to pass variables to subflow as per the documentation I showed...otherwise...you would follow the documentation above to do it.

Thanks!

Please mark post as Helpful/Correct, if applicable. Thanks!


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

So if I want to add a new input in subworkflow layer 2, then i habe to add it also in subworkflow layer 1 and reference it in call of subworkflow layer 2 + add it in core workflow and reference it in call of subworkflow 1? That is much work and its most likely to do mistakes. Do you have an idea how to work around that? Create a new table and store there saved configuration from my catalogitem and read from that table in my subworkflow layer 2?