
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 12:17 PM
What is the best way to dynamically create ECC queue records directly from a workflow, AND retrieve the results of the ECC command within the workflow?
In other words, I want to be able to run commands on a linux mid server directly. Then I want to be able to retrieve the results within the workflow, and chose a different workflow action depending on the results of the command.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 09:57 AM
The result of ecc_queue.insert() in your code will return the sys_id of the ecc_queue record you created. That is the instruction for the MID server to process. After the MID server processes the command, it will write back another record to the ecc_queue table with the queue 'input.' The payload should contain the sys_id of the record from the "output" queue to which the "input" record is a response.
You can probably find that in the XML in the following node (using XPath): results/parameters/parameter[name='ecc_queue']/value
I say probably because the payload can be different depending on what the MID server is doing. However I'm fairly confident that the response to an "output" queue command will be in this format.
The result of that XPath should match the sys_id of the record you created in your script above.
What you can do is save the sys_id to the workflow scratchpad, then create a series of activities to wait for a period of time, check for the "input" record to appear (instead of XPath, you can query for payloadLIKEparameter name="ecc_queue" value="[sys_id]"), and if nothing has found, use a turnstile to loop back to the wait timer and check again until you find it. Make sure you set the max tried on the turnstile to something reasonable.
Let me know if that helps.
Thanks
Nick

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 12:06 PM
'The result of ecc_queue.insert() in your code will return the sys_id of the ecc_queue record you created.' Yep, that's pretty much the solution! I figured this out a while back but I forgot to update this question. At the time I wrote a post with the details. https://community.servicenow.com/community?id=community_question&sys_id=db8293a1db101fc01dcaf3231f96195b

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 12:09 PM
Nice write-up!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 08:01 AM
The response_to field on the input record will match the sysID of the output record in the ECC Queue. This simplifies your query

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 12:03 PM
Hello, I forgot to update this question before but I have resolved this and I wrote a up a post with all of the details:
https://community.servicenow.com/community?id=community_question&sys_id=db8293a1db101fc01dcaf3231f96195b