flow designer - How to use subflow inputs in subflow script

Sonali Jadhav
Mega Expert

Hi,

I have created flow designer for one catalog item and using subflow in that .

I am passing trigger requested item as input in subflow.

How to use those input variables in catalog task description script. I want to use RITM's sys_id in subflow script.

can someone please help.

 

find_real_file.png

 

Regards,

Sonali j

 

1 ACCEPTED SOLUTION

So can you share a bit of what you are scripting? Anyway, without knowing that, you do have a subflow input "ritm", you can access that in script using:

var ritm_sysid = fd_data.subflow_inputs.ritm

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

9 REPLIES 9

What's the reason for wanting to use the script field? As you can drag and drop or use the data pill.

Scripting is certainly possible, though why?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

In description part of catalog task we need variables values to be populated.

So can you share a bit of what you are scripting? Anyway, without knowing that, you do have a subflow input "ritm", you can access that in script using:

var ritm_sysid = fd_data.subflow_inputs.ritm

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

the subflow_inputs variable doesn't comeup in auto-suggestion. Is that true?

Ankur Bawiskar
Tera Patron
Tera Patron

@Sonali Jadhav 

since you want to set catalog task description with variable value; you can use the inline script in f(x) for task description field

No need to create subflow for this

As mentioned by Mark you can drag and drop; but here is an Script example in f(x) for Description field

You can enhance it as per your requirement.

var sysId = fd_data.trigger.current.sys_id;

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', sysId);

gr.query();

if(gr.next()){

return "My Variable Value " + gr.variables.variableName; // give the variable name here

}

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader