How to change queue item status if item is past deadline

Is there a way to change the status of an item in a queue if the current time is past the deadline that was previously set? I wish there was a way to use a ‘Compare Date’ activity to compare the current time against the deadline of the QueueItem variable.

Why doesn’t Orchestrator automatically do this?

Using the Orchestrator API you can do this… It’s a bit of a hassle, but if it’s something you need to do, using the endpoint: odata/QueueItems?$filter=QueueDefinitionId%20eq%20<QUEUE_ID> you can get all your queue items. You can filter the results by a number of different things, in this example I had $top=3&$filter=QueueDefinitionId%20eq%20<QUEUE_ID> in my request.

Below is an example of the JSON Response which includes the DueDate key that can then be parsed as a DateTime for comparison:

{
  "@odata.context": "https://Orchestrator_URL.xyz/odata/$metadata#QueueItems",
  "@odata.count": 19,
  "value": [
    {
      "QueueDefinitionId": 53,
      "OutputData": null,
      "Status": "New",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "Reference": "TEST ITEM",
      "ProcessingExceptionType": null,
      "DueDate": "2019-10-21T20:22:37.443Z",
      "Priority": "Normal",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{}}",
      "CreationTime": "2019-10-31T20:22:41.357Z",
      "Progress": null,
      "RowVersion": "AAAAAAAA4OM=",
      "Id": 26362,
      "ProcessingException": null,
      "SpecificContent": {},
      "Output": null
    },
    {
      "QueueDefinitionId": 53,
      "OutputData": null,
      "Status": "New",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "Reference": "TEST ITEM",
      "ProcessingExceptionType": null,
      "DueDate": "2019-11-10T21:21:05.197Z",
      "Priority": "Normal",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{}}",
      "CreationTime": "2019-10-31T20:21:07.527Z",
      "Progress": null,
      "RowVersion": "AAAAAAAA4OI=",
      "Id": 26361,
      "ProcessingException": null,
      "SpecificContent": {},
      "Output": null
    },
    {
      "QueueDefinitionId": 53,
      "OutputData": null,
      "Status": "Abandoned",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "Reference": "",
      "ProcessingExceptionType": null,
      "DueDate": null,
      "Priority": "High",
      "DeferDate": null,
      "StartProcessing": "2019-10-30T19:26:08.087Z",
      "EndProcessing": "2019-10-31T20:00:01.117Z",
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{}}",
      "CreationTime": "2019-10-30T19:26:08.087Z",
      "Progress": null,
      "RowVersion": "AAAAAAAA4N8=",
      "Id": 26360,
      "ProcessingException": null,
      "SpecificContent": {},
      "Output": null
    },
  ]
}

Once you get the response and deserialize it to a JObject, you can do the following: DateTime deadlineDate = System.DateTime.Parse(responseJObject("value")(0)("DueDate").ToString);

You can then compare this DateTime to DateTime.Now.

Keep in mind you will likely need to first make a request to the following endpoint: odata/QueueDefinitions to get the ID of the Queue you’re looking for unless you want to hardcode it into the HTTP Request.

Thanks Mike. I wish my skillset included the ability to solve for this, but I’m more of a business analyst than developer. UiPath is user-friendly, but not in this instance. I think they need to develop more functionality within the activities surrounding queues. It’s pretty limited right now.