Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Script step output variable value not passing to custom action output variable in Flow Designer

VullankiL
Tera Contributor

Hi,

I have an issue. In flow designer, there is a script step in one custom action, where there is output variable called "object_value" (type object). And I am populating it in script step using outputs.object_value. After populating it, I have converted it into text value using JSON.stringify() and tried to print it in logs using gs.error(), then the key-value pairs are getting printed correctly.

So later, I am passing it to the custom action Output Variable called "objectValue" (type object).  Now after publishing this custom action. If I try to access this object in flow designer (outside of the custom action) using Log statements. Then the object is getting printed like [Object object], but if I use JSON.stringify() method and print it.. it is just returning empty "{}" without any key-value pairs. Even if I try to access keys and values using methods like Object.keys(object_value), but it is still returning nothing.

Please help me with this.

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@VullankiL 

very difficult to visualize without screenshots.

If your custom flow action is working fine then when you use that in flow or subflow it should work fine ideally

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar ,
Below is the screenshot of log step that I have added in the flow after the custom action step. And I am taking this object_value from custom action step.

VullankiL_0-1741336090752.png

the object value is getting printed like [object Object]. But If I try to print it by converting to JSON, then it is returning just "{}". Example:

VullankiL_1-1741336242278.png

What could be the reason?

@VullankiL 

where is object_value defined?

you should use fd_data.<actionStep>.<output variable> in your log step to get the value

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Yes @Ankur Bawiskar , I have taken like that only, just not there in the screenshot. Any other possible reason for this?