- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
03-21-2022 01:39 PM
I have some automation that I'm working on and I am not seeing the expected results. I broke the script down into the following simple version.
ScriptA which is:
demisto.executeCommand("ScriptB", {})
ScriptB which is:
return_results("ScriptB Called")
when I run ScriptA, is there a reason ScriptB would not write to the war room?
03-21-2022 04:58 PM - edited 03-21-2022 05:00 PM
Hi @jboyd98 ,
I would just recommend removing the [0]['Contents'] on the end of executeCommand, and do return_results(str(res)) so that you can get an understanding of the entire entry structure. Since you have multiple return_results() in ScriptB, this means the second output would actually be under res[1]["Contents"].
I hope this helps!
-Lance
03-21-2022 01:49 PM
The results of ScriptB are returned from the demisto.executeCommand function. To capture the output of ScriptB, ScriptA should look something like this:
res = demisto.executeCommand("ScriptB", {})[0]["Contents"]
return_results(res)
03-21-2022 02:15 PM - edited 03-21-2022 02:17 PM
Thanks @tyler_bailey That fixed the above.
I used the above as a test, but really what I'm trying do is understand why the context data is not available in script B.
ScriptA which is:
return_results(demisto.incidents()[0])
res = demisto.executeCommand('ScriptB', {})[0]["Contents"]
return_results(res)
ScriptB which is:
return_results("ScriptB Called")
return_results(demisto.incidents()[0])
Everything is expected in War Room except my ScriptB "demisto.incidents()[0]" does not seem to be called or it's empty so it doesn't return anything to war room? ScriptA incident data is returned in the war room as a json as expected.
When ScriptB tries to reference the incident data its like it can't find it??
Does that question make sense?
03-21-2022 04:58 PM - edited 03-21-2022 05:00 PM
Hi @jboyd98 ,
I would just recommend removing the [0]['Contents'] on the end of executeCommand, and do return_results(str(res)) so that you can get an understanding of the entire entry structure. Since you have multiple return_results() in ScriptB, this means the second output would actually be under res[1]["Contents"].
I hope this helps!
-Lance
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!