return results from python request(s) output

cancel
Showing results for 
Search instead for 
Did you mean: 

return results from python request(s) output

L1 Bithead

I have a custom integration where I am trying to map results (in strings) that are emails

into output to use for the next defined task or playbook.


I figured, IF the output looked like

 

output = 'email1\nemail2\nemail3' 

that I could do a return_results(output)

and then in the Script settings, map the 'outputs' section under Arguments to "context path" ScriptName.output"

and then the data would appear?

what am I doing wrong? How do I return the results from one command to use it  elsewhere?

1 ACCEPTED SOLUTION

Accepted Solutions

L1 Bithead

You first want to call CommandResults to build the result you want to pass to return_results:

https://xsoar.pan.dev/docs/integrations/code-conventions#commandresults

 

Example:

emails = "email1,email2,email3"

 

output = emails.split(",")

 

result = CommandResults(
outputs_prefix="MyCustomEmails",
outputs=output,
readable_output=tableToMarkdown("My Custom Emails", output, headers=["Emails"]))

return_results(result)


Your outputs in the automation would by defined as "MyCustomEmails"

ContextContext

 

You can reference the CommandResults in the Script Helper as well.  

View solution in original post

1 REPLY 1

L1 Bithead

You first want to call CommandResults to build the result you want to pass to return_results:

https://xsoar.pan.dev/docs/integrations/code-conventions#commandresults

 

Example:

emails = "email1,email2,email3"

 

output = emails.split(",")

 

result = CommandResults(
outputs_prefix="MyCustomEmails",
outputs=output,
readable_output=tableToMarkdown("My Custom Emails", output, headers=["Emails"]))

return_results(result)


Your outputs in the automation would by defined as "MyCustomEmails"

ContextContext

 

You can reference the CommandResults in the Script Helper as well.  

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!