Skip to main content
Question

Priority between bot queue and scheduled bot

  • February 26, 2026
  • 6 replies
  • 41 views

Forum|alt.badge.img+11

Hi everyone,

 

I have created a master bot that gets several customer commands to process.

This master bot adds to a work queue one element for every command. For example if there are 3 commands, 3 elements will be added to the work queue.

I have set the priority of the master bot to low and my expectation was that one : every unit process is processed and only afterwards the master bot is run.

However, I have noticed that the master bot takes priority over unit processes. As it is still pending on the customer side, I have a problem of double bot run.

Does anyone know how to avoid this problem and always have the work queue bots running BEFORE the scheduled bots ?

I hope I am being clear, do not hesitate to tell me if that needs precision.

6 replies

Forum|alt.badge.img+11
  • Author
  • Flight Specialist | Tier 4
  • February 26, 2026

Would a loop : for each work item in queue with status “On-hold” → [if there is at least an element, stop the bot, else proceed] in the master bot be a solution ?

 

Edit : no, you can only loop through on hold, failed or Data error, not status “New”


dgabbad369
Forum|alt.badge.img+1
  • Cadet | Tier 2
  • February 26, 2026

Hi ​@Augustin, At the start of the master bot, you can add a check using WLM APIs to determine whether the queue has any pending items. If pending items exist, stop the master bot, else continue. Let me know if that works for you.


Forum|alt.badge.img+11
  • Author
  • Flight Specialist | Tier 4
  • February 26, 2026

Hi ​@Augustin, At the start of the master bot, you can add a check using WLM APIs to determine whether the queue has any pending items. If pending items exist, stop the master bot, else continue. Let me know if that works for you.

Hi dgabbad369,

This is what I was looking for, but as per the documentation : https://docs.automationanywhere.com/bundle/enterprise-v2019/page/wlm-api-supported-v4.html 

it is only possible to get the queue name and info (it works for me) and to update/add work items to the queue. Not to get the list of work items to be processed. Or am I missing something ?

 

I have tried with GET  {my control room url}/v4/wlm/queues/{id queue}/workitems  or GET {my control room url}/v4/wlm/queues/{id queue}/file but it says “Not found” 


Forum|alt.badge.img+11
  • Author
  • Flight Specialist | Tier 4
  • February 26, 2026

Okay, it could work using the GET  {my control room url} /v3/wlm/queues/{id queue}/workitems/{workitem id} If I know beforehand the id of the latest work queue.

But how can I get to know that information ?


Forum|alt.badge.img+11
  • Author
  • Flight Specialist | Tier 4
  • February 26, 2026

Okay, I think I found a workaround : persist a variable workitemid in a local file, get it and store it as a variable, increment it and for each increment get the status through API → if the status is not failed or completed, stop the bot there.

If all the workitemids of the previous iterations have ended, proceed the rest of the bot.

 

But very frankly, this is a workaround and I would have expected a solution to be built-in. The way you can’t loop through new, active or ready to run with the bot components saddens me.


dgabbad369
Forum|alt.badge.img+1
  • Cadet | Tier 2
  • February 26, 2026

Hi ​@Augustin, below solution works well and has been tested in one of my projects. Let me know if you face any issues.
1. Get Token
POST <AAControlRoomURL>/v2/authentication
Parameters: 
{
"username": "{{username}}",
"apiKey":  "{{key}}",
"multiLogin": true
}

2. Get QueueId: Once you open your queue in browser, you will see QueueId in URL

3. Get Count of pending workitems
POST <AAControlRoomURL>/v3/wlm/queues/<QueueIdFromPreviusStep>/workitems/list

Pass your token in header with name x-authorization
Parameters:
{
    "filter": {
        "operator": "eq",
        "value": "READY_TO_RUN",
        "field": "status"
    }
}

That's it, in the response you will find count of pending queue items.