ECC Queue workflow return status

Katie A
Mega Guru

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.

http://www.john-james-andersen.com/blog/service-now/command-line-execution-with-servicenow-mid-serve...

1 ACCEPTED SOLUTION

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

View solution in original post

8 REPLIES 8

'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


Nice write-up!

The response_to field on the input record will match the sysID of the output record in the ECC Queue. This simplifies your query

Katie A
Mega Guru

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