Command Line syntax question

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

Command Line syntax question

L0 Member

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

Brian R.
1 accepted solution

Accepted Solutions

L3 Networker

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 🙂

View solution in original post

3 REPLIES 3

L0 Member

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

 

L3 Networker

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 🙂

L0 Member

Its all about the Context.  Im starting to see that now.  Its like a giant collection of global variables.  Thanks for the help.

Brian R.
  • 1 accepted solution
  • 821 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!