ScriptA not calling ScriptB as expected

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ScriptA not calling ScriptB as expected

L2 Linker

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?

 

 

1 accepted solution

Accepted Solutions

L2 Linker

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

 

 

View solution in original post

3 REPLIES 3

L2 Linker

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)

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?

 

 

L2 Linker

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

 

 

  • 1 accepted solution
  • 2423 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!