While True Condigtional

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

While True Condigtional

L1 Bithead

Hello Everyone,
I want to ask about the while loop condition in XSOAR, is it possible to do that? for example i want to check condition the agent status to see whether it is connected or not, if it is not connected set 10minutes delay and then check the condition again

 

Thank you!

3 REPLIES 3

L1 Bithead

Loop condition is indeed an option!

 

You can achieve it by 2 examples:

  1. Wrap your task in a sub-playbook and use the built-in Loop mechanism to rerun the playbook using Loop automation.
  2.  Use custom task (Script) in python that gets the data via argument and runs the while True loop with all the logic you need

 

personally - option 2 is preferred, much more simple to create and test.

 

Good luck!

Thanks for your answer @ofmoalem , I used technique no 2, but I got this error 

Error from Scripts is : Script failed to run: 
Timeout Error: Docker code script failed due to timeout (exampleScript). Consider changing timeout value for this automation. (2604) (2603)

to resolved this issue I increased the timeout and the number of retries but I don't think this is same as we used to while True condition

L1 Bithead

Well, this   is because you try to implement the wrong logic into automation script which meant to be one time flow and not endless recursive loop.

 

 

in case where the waiting time is not consistent and   not static - Schedule Commands decorators are you friends-to-go.

XSOAR features option that built exactly for that use case - unknown number of loops needed.

regular tasks within playbook running via workers, but schedule commands do not run via workers, which means they are not limited by time - they are limited BY RESULTS.

schedule tasks give you the option to run the loop over and over until you get the output you wish for via code.

 

you can read more about it via offical docs:

Scheduled Commands | Cortex XSOAR

 

the last example there is a great baseline for your use case!

 

Best of luck!

 

 

Scheduled Commands | Cortex XSOAR

  • 2706 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!