
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 11:35 AM
Hi everyone,
I've created a Data Stream Action that gets paginated records from REST endpoint.
Or actually the one that SHOULD get this records, but it doesn't.
What can I do to make this work?
Data Output (in execution details after I test the action):
Action Outline:
Execution details when I test, show that REST Step returns a proper response body.
Splitter didn't throw any errors, it should be fine.
In Parsing, Script Parser step, I use script:
(function parse(inputs, outputs) {
var glacier_rec = JSON.parse(inputs.sourceItem);
outputs.targetObject.id = glacier_rec.glacier_id;
outputs.targetObject.name = glacier_rec.name;
outputs.targetObject.country = glacier_rec.country;
outputs.targetObject.latitude = glacier_rec.latitude;
outputs.targetObject.longitude = glacier_rec.longitude;
})(inputs, outputs);
And the Output is:
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Action Designer
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:15 PM - edited 03-20-2025 10:24 PM
It's very sad to say this.. but this solved the problem:
(I just stripped some spaces in Parsing Script 😑)
(function parse(inputs, outputs) {
var glacier_rec = JSON.parse(inputs.sourceItem);
outputs.targetObject.ID=glacier_rec.glacier_id;
outputs.targetObject.name=glacier_rec.name;
outputs.targetObject.country=glacier_rec.country;
outputs.targetObject.latitude=glacier_rec.latitude;
outputs.targetObject.longitude=glacier_rec.longitude;
})(inputs, outputs);
The hint came from here: https://www.servicenow.com/docs/bundle/xanadu-integrate-applications/page/administer/integrationhub/...
Exactly this made me think about stripping the spaces: (btw - in xml parsing script example the spaces are not stripped..)
Finally it works!
Have a great day! 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 12:07 PM
Hello @Beata I_owiecka
Try this:
(function parse(inputs, outputs) {
var glacier_rec = JSON.parse(inputs.sourceItem);
// Ensure targetObject is defined
outputs.targetObject = {};
outputs.targetObject.id = glacier_rec.glacier_id;
outputs.targetObject.name = glacier_rec.name;
outputs.targetObject.country = glacier_rec.country;
outputs.targetObject.latitude = glacier_rec.latitude;
outputs.targetObject.longitude = glacier_rec.longitude;
})(inputs, outputs);
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 12:14 PM
Hi @Beata I_owiecka,
Does your REST API returns always 1 object?
if so please adjust your Parsing function as:
(function parse(inputs, outputs) {
var glacier_rec = JSON.parse(RESPONS_BODY_FROM_REST_STEP);
outputs.targetObject.id = glacier_rec.result.glaciers[0].glacier_id;
outputs.targetObject.name = glacier_rec.result.glaciers[0].name;
outputs.targetObject.country = glacier_rec.result.glaciers[0].country;
outputs.targetObject.latitude = glacier_rec.result.glaciers[0].latitude;
outputs.targetObject.longitude = glacier_rec.result.glaciers[0].longitude;
})(inputs, outputs);
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 09:48 PM
Hi @Medi C, @Vishal Jaswal,
Before the Parsing script I added Splitter step with Item Path: $.result.glaciers
So I think the result is one glacier at a time and logs are comfinminig that.
I added two logs at the end of a script:
...
outputs.targetObject.longitude = glacier_rec.longitude;
gs.info("* ❤️ glacier_rec.name: " + glacier_rec.name);
gs.info("* ❤️ outputs.targetObject.name: " + outputs.targetObject.name);
})(inputs, outputs);
And I got result:
So I'm wondering why output.targetObject is not passing the data to the outputs. Maybe the problem is in my Action Output configuration?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 10:15 PM - edited 03-20-2025 10:24 PM
It's very sad to say this.. but this solved the problem:
(I just stripped some spaces in Parsing Script 😑)
(function parse(inputs, outputs) {
var glacier_rec = JSON.parse(inputs.sourceItem);
outputs.targetObject.ID=glacier_rec.glacier_id;
outputs.targetObject.name=glacier_rec.name;
outputs.targetObject.country=glacier_rec.country;
outputs.targetObject.latitude=glacier_rec.latitude;
outputs.targetObject.longitude=glacier_rec.longitude;
})(inputs, outputs);
The hint came from here: https://www.servicenow.com/docs/bundle/xanadu-integrate-applications/page/administer/integrationhub/...
Exactly this made me think about stripping the spaces: (btw - in xml parsing script example the spaces are not stripped..)
Finally it works!
Have a great day! 🙂