The CreatorCon Call for Content is officially open! Get started here.

Checklist Template in Flow Custom Action

AmolJ
Tera Expert

I have a custom action in a flow. It's input is the "Template" field of checklist_template table record. I then have a script step that converts it into a JSON object in order to get the "items" array out. But no matter what data type I use for action's output, it just comes out empty.

Any clues?

Thanks

1 REPLY 1

Ravi Gaurav
Giga Sage
Giga Sage

Hi @AmolJ 
I see what’s happening in your flow. In ServiceNow Flow Designer, custom action outputs don’t automatically serialize complex fields (like a JSON string inside the Template field of checklist_template) into a JSON object you can manipulate. They’ll just be treated as plain strings unless you explicitly parse them.

Set the action’s output for Template to String.
Don’t try to force it as JSON or Array at this stage — Flow Designer doesn’t handle that automatically.
Inside your Script step, use JSON.parse() on that string to convert it into an object:
something like below :

try {

var parsed = JSON.parse(inputs.template);

outputs.items = parsed.items || [];
} catch (e) {
gs.error("Failed to parse template JSON: " + e.message);
outputs.items = [];
}

Make sure your Script step has an output variable called items and set its type to Array of Strings or Array of Objects depending on how you need to use it later in the flow.

Try and let me know

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/