
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2022 04:03 AM
I'm trying to configure a Datastream action within flow designer.
However, when I test run the Datastream, I get an "Internal Server Error", and in the node logging I receive the following error message:
Invalid query detected, stack trace below [Unknown field element in table sys_flow_step_definition]
I have not used any scripts, the steps I went through were as follows:
- Create the datastream
- Under "Request" answer REST Step
- Fill in the correct connection details and Request details on the Rest step
- Press Test
(SoI have not added any inputs, outputs or scripts -- When I add them, this doesn't seem to change the outcome)
When I do the same in a "Normal" flow action with a REST step, this executes. But with the Datastream action I get the above error.
I'm hoping that I'm missing something terribly simple, but I can't figure out what.
Anyone else had the same issue and know a solution?
Working on a PDI on San Diego EA Patch 0 hotfix 1
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2022 10:00 AM
So, for future reference, I eventually was able to figure this out.
In the documentation, it states the following:
When designing a Data Stream action, you must create a single output of type Object or Dynamic Object. The Script Parser step maps items in the stream to this object using the targetObject global object.
The word must here is key. Since, apparently, if you don't have any output, this results in the internal server error.
I was working top-to-bottom on this, first trying to get the REST-call working, before worrying about output, but turns out, you have to 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2022 06:13 AM
Hi,
This may be due to below reason:
Cause:
This error is produced by a business rule on the affected table (Usually that table is part of the error message IE: sc_request).
The business rule will attempt to call the GlideRecord function next() on a GlideRecord object, when that object has no more records to return on the list.
IE:
var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id', current.request);
gr.query();
gr.next(); //<----- Problem line
This code should only call a single row, however we attempt to run gr.next(). This will trigger the invalid query error.
Resolution:
Be careful when using gr.next() on a GlideRecord object. Usually these are part of a conditional statement such as a while loop or an if otherwise it would be a similar equivalent to an out of bounds error in an array.
Simply avoid using gr.next() outside of conditional statements if not needed to loop through one or more records. If only returning one record and the unique sys_id is know, please use the gr.get('REPLACE-SYS-ID-HERE') function.
Also for creating Data Stream there is a good video available which you can refer which shows steps on how to do this:
https://www.youtube.com/watch?v=-lmbcm6j6Ew
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2022 10:00 AM
So, for future reference, I eventually was able to figure this out.
In the documentation, it states the following:
When designing a Data Stream action, you must create a single output of type Object or Dynamic Object. The Script Parser step maps items in the stream to this object using the targetObject global object.
The word must here is key. Since, apparently, if you don't have any output, this results in the internal server error.
I was working top-to-bottom on this, first trying to get the REST-call working, before worrying about output, but turns out, you have to 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 02:43 PM
Thanks Mark.. Stuck on the same issue for a day and then searched in the community.. You are life savor 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2025 12:38 PM
This info was helpful. I was trying to test the REST step without output defined. After defining the output object, Data stream flow tested successfully