- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
08-20-2024 01:19 PM
How do I combine commands on the #XSOAR command line?
If one command wants a list, I would like to call a list, not enumerate it on the command line.
For example, the RandomElementFromList works like this:
!RandomElementFromList count=1 value="banana, orange, potato" may randomly respond with "orange". Easy Peazy.
getList works like this:
!getList listName=fruitAndVegatables will respond with the entire list. Nice.
What if I have a long list named fruitAndVegatables stored and I want a compound command that will pick a value by combining the randomElementFromList command and the getList command? What is the syntax?
My guess is this, but it doesn't work:
!RandomElementFromList count=1 value=!getList listName=fruitAndVegatables
What combination of quotes, curly brackets and delimiters do I need? I am interested in the syntax. I did not see a relevant example.
Thanks
08-21-2024 01:00 AM
Hey there,
just adding and summarizing what the other folks already shared....
The idea of running an a command within a command is not really forseen by XSOAR, I know you can do some magic with dt https://xsoar.pan.dev/docs/integrations/dt but not to the extend you are looking for.
So the best way forward is using the Context and keep manipulating it, basically running the commands in sequence
!getList listName=fruitAndVegatables extend-context=mylist
!RandomElementFromList count=1 value=${mylist}
or something along those lines 🙂
08-20-2024 11:30 PM
In completion to the @John374McCray answer, you can use the extend-context parameter to ensure your context path is specific to that command (in case you use getList twice for example) : https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context
08-21-2024 01:00 AM
Hey there,
just adding and summarizing what the other folks already shared....
The idea of running an a command within a command is not really forseen by XSOAR, I know you can do some magic with dt https://xsoar.pan.dev/docs/integrations/dt but not to the extend you are looking for.
So the best way forward is using the Context and keep manipulating it, basically running the commands in sequence
!getList listName=fruitAndVegatables extend-context=mylist
!RandomElementFromList count=1 value=${mylist}
or something along those lines 🙂
08-22-2024 05:48 AM
Its all about the Context. Im starting to see that now. Its like a giant collection of global variables. Thanks for the help.
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!