I am trying to retrieve items in the queue with the Successful and Failed states. I wanted to see what was the latest status of the retrieved queue item so that I can create an excel spreadsheet report/audit log.
Use get queue items activity and check status as successful and failed in properties. You will get list of successful and failed queue items
What @Gaurav_Malhotra said is what you need to do…
To add to it use the output say var_queueitems to get each status
For that use a for loop and assign the output of get queue items to it and change the type argument in for loop properties to queueitem
Then inside the loop currentitem.Status will give the status failed or successful if failed …currentitem.processingexception.Type will give the exception type app/bus
And currentitem.Processingexception.Details will give you the exception message
Cheers
Thanks @Gaurav_Malhotra & @Anil_G.
I was actually able to retrieve the queue items that are in Successful and Failed states. I just needed to find the latest run for a queue item and grab that for my reporting purposes. I didn’t set the ‘Enforce unique references’ to true so I am allowing duplicates item in the queue.
Then after retrieving all the items…use the following
Queueitems.Groupby(function(x) x("GroupingColumn").ToString).Where(function(x) x.OrderBy(function(y) cdate(y.StartExecutionTime)).Last)
This will group on grouping column and then order by the execution time and get the last or the latest item for each group
Cheers
Thanks @Anil_G . I tried it and I am getting this error:
My bad this use this I left specific content
Queueitems.Groupby(function(x) x.SpecificContent("GroupingColumn").ToString).Where(function(x) x.OrderBy(function(y) cdate(y.StartExecutionTime)).Last)
cheers
Here’s what I used:
qForChecking.Groupby(function(x) x.SpecificContent(“AccessNumber”).ToString).Where(function(x) x.OrderBy(function(y) cdate(y.StartTransactionTime)).Last)
I used StartTransactionTime as I coulnd’t find the StartExecutionTime option. But I am getting a new error now:
Done.
But now getting a different error:
I guess the variable you are assigning to is a string…it should be of same type as your qForchecking
cheers
I am using a write line activity to output the result. I just want to see what’s happening there.
Hi @redanime94
Can you try this
- Add a “Get Queue Items” activity to your workflow and set the “QueueName” property to the name of your queue.
- In the Properties panel, set the “Filter” property to filter the items based on a unique reference. If you didn’t set the “Enforce unique references” option to true, you can filter the items based on the “SpecificData” field instead. For example, if your queue items have a field named “ID” that uniquely identifies each item, you can use the following filter expression:
SpecificContent("ID") = item.ID
- Add a “For Each” activity to iterate over the retrieved queue items.
- Add a “Get Transaction Item” activity inside the “For Each” activity and set the “TransactionItem” property to the current queue item variable (e.g., item).
- In the Properties panel of the “Get Transaction Item” activity, set the “Filter” property to retrieve only the latest transaction for the current queue item. You can use the following filter expression:
CreationTime = (From t In in_TransactionItem.Transactions Order By t.CreationTime Descending Select t.CreationTime).FirstOrDefault()
I hope it helps you
with right line you cannot…assign it to same variable again and then check the details from locals panel for using a for loop
cheers
I have assigned the code that you gave me to an IEnumerable. What will be my output if I put it inside the for each loop?
It will be a queue item only…I am just filtering out the duplicates from the ienum of queueitems thats all…no change in type of varible
Cheers
Hi @Anil_G - I got it working! However, I seem to be getting all the run for that queue item. I just need to get the latest run for that queue item.
For each group i guess it would give you the latest runs only…
You have any cut off date as well?
Cheers
I am getting the queue items way back up to 20 days ago