- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
04-29-2022 01:14 PM
Hey there. I have what I believe to be a python syntax question. We have a playbook with two automations. The first downloads a file, which is successful. The first automation has an output of the EntryID.
The second automation needs to use the entryID to get the file that was just downloaded it and perform some tasks.
Finally the question; What is the syntax in the second automation to reference the input entryID?
In powershell it looks like: $entryId= $demisto.Args()["EntryId"]
What is the python equivalent?
The goal of the second automation is retrieve the downloaded csv, parse it and then insert data into the database.
We’ve tried:
params=demisto.params() - error: params doesn't exist
args=demisto.args() - error: args doesn't exist
demisto.params()["EntryId"] - error: params doesn't exist
result = demisto.ExecuteCommand('getFilePath', @{id = entryId})[0]["Contents"]["path"] - i cant get to the entry id
We’ve reviewed:
https://xsoar.pan.dev/docs/integrations/code-conventions
https://xsoar.pan.dev/docs/reference/api/common-server-python
System scripts for examples
Our Playbook:
Automation 1 Inputs
Outputs
Automation 2
Input
05-02-2022 08:01 AM - edited 05-02-2022 08:14 AM
figured out what i was missing. obviously I am new to demisto/xsoar.
I had outputs and inputs/attributes listed. the piece i was missing was mapping the inputs to outputs in the pervious step.
04-29-2022 01:22 PM - edited 04-29-2022 01:27 PM
to reference an input in python, you would use demisto.args().get('EntryId'). Job_softwaredate_Update_Trip need to have an argument called 'EntryId' on it.
05-02-2022 06:07 AM
totally appreciate the response C. I think i was confused between inputs and attributes. Once i added the argument, i now see the default value. So making progress.
Since I am seeing the default value for the argument instead of the value that was returned by the previous automation, i'm either not referencing the right var or it isn't set up to be returned to the next autimation.
The output on the previous automation has an output -
Do I need to have the file as part of the reference?
05-02-2022 06:14 AM - edited 05-02-2022 07:44 AM
something i just noticed is in the warroom message for the download step, EntryID isn't in the list of outputs
It is in the output list for the download step just like the rest that are being displayed above step. However i can't reference any of the file attributes - demisto.results(demisto.args().get('size'))
demisto.results(demisto.args().get('Type'))
demisto.results(demisto.args())
The only value in args is the default value i set for the attribute. So the values/outputs from the download step, are not being passed to the next step. Not sure what I am doing wrong or the thing to post to help you to help me . . .
05-02-2022 08:01 AM - edited 05-02-2022 08:14 AM
figured out what i was missing. obviously I am new to demisto/xsoar.
I had outputs and inputs/attributes listed. the piece i was missing was mapping the inputs to outputs in the pervious step.
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!