Write and read Queue Item 'Output' arguments problem

Hey Guys!

I ran into two problems related to the manipulation of a queue item’s ‘Output’ argument set.

Business need (background):

I run multiple .xaml-es in a REFramework to process several queue items from an orchestrator queue (e.g. transactions) and at the end of each processing cycle I set a number of Booleans to record if all processing activities were carried out successfully (OR failed during processing).

I need this info (succesful/failed Boolean values) in order to pass them on to the queue items retried by Orchestrator (in the retry run I would like to redo only the failed processing parts to save time and avoid redundant robot work!).

The idea is to pass the Boolean values to the ‘Output’ arguments of the Transaction Item so they would be copied to the newly created (retried) queue items.

The first problem:

The Set Transaction Status activity only lets me write to ‘Output’ if the transaction is Succesful, so I cannot write to Failed items (which would be the purpose!). I tried to circumnavigate this limitation by first setting the item to Succesful status, passing the Boolean values to ‘Output’ and then setting the item’s status to Failed (all this by Set Tr Status activity).

The Transaction Item in the above scenario will be retried, but when Orchestrator creates the retried item (as ‘New’ item) the previously recorded ‘Output’ data is gone.
Is it at all technically possible what I try to achieve?
Is there any solution to transfer the ‘Output’ content to the ‘New’ item?

The second problem:

When I try to read the ‘Output’ arguments of a (succesful) Transaction Item (to which I passed values in the very preceeding step!), it throws “Object reference not set to an instance of an object”. I am using the QueueItem.output(“{field defined}”) command.

Is there a syntax error here?
What else can I try to get the ‘Output’ arguments?

Cheers!

1 Like

Could anybody please give any hints about my questions?

Thanks!

1 Like

QueueItem.Output(“field defined”).toString —> It works.

You don’t have to use curly braces. I was searching for same thing so i thought it to share it here so that it can help someone.

First problem: Yes it is still the limitation. However, if you set the item to “failed” as Business Exception, it won’t be retried and your output data still lives (I learned it the hard way…)

Second problem: I think Sachin’s answer is correct. Unless you’re calling that method on a queue item that doesn’t have output data.

Hi @oralolle and @sachinbhardwaj
i am facing same issue (2nd one mentioned in problem statement). I can see there are values in output section of transaction item from orchestrator. but in queueitem(transactioitem) it is showing output as null. Thats why getting obj reference error.
pls help

You need to refresh the queue item in order to get the updated Output value. You could for example use Get Queue items with reference or get the queue item with api using the id.

Did not get that, could you please elaborate?
Basically i am adding value to output with set transaction making it successful. Then i am postponing that transaction so bot can pick it during next run and fetch output data at that time (which takes transaction using get transaction item activity)

At what point are you trying to get the Output? After setting it, it will still be null, until you refetch it from the queue.

Yes, i got that point… and i am not trying to access it in same run…
When bot will start the next run it will pick those posponed (output updated transactions)

Why are you postponing it if it’s Succesful? That would signify that you are done with the transaction. Also, how are you doing it, as I think Postpone Transaction Item activity only works if the item’s status is InProgress?

its a requirement of my use case, actually i just need to postpone that transaction and need to store one date somewhere in transaction item (which i am achieving currently storing it in output section), so when next time when bot pick that postponed transaction i can perform few checks based on that stored date.
since we can not add/update specific data in transaction item i am trying to store it in output.
And yes even if i used set status (Successful) to add output and later used postpone it is still postponing the transaction perfectly.

Set Transaction Progress activity feels like a better fit in this case, because in that way you don’t need to change the status before Postponing.

I get this error message “Postpone Transaction Item: Invalid transition from a final status. Error code: 1866” when I try to postpone a Successful transaction, that’s why I’m asking.