Set and then get queue item by refrence

so I’ve got this situation where I need it to look though the tickets on a telnet system pick out the tickets work the ones it can and mark if it’s a success, temp fail or final fail.
problem is that in most cases the tickets still show up in the telnet system after being worked. and they need to stay in there for stuff that happens latter. I got it mostly worked out, I got it working the tickets and determining the sate at the end just fine. but I need a way for it not to work the same ticket more then once if it’s still in there. I thought since I got access to Orchestrator I’ll make a separate que for it to put the tickets in, use the ticket number as the reference value. and then I’ll be able to tell if the ticket has been worked as it’ll say duplicate transaction. that works.

my problem is though I don’t know if it was a temp fail or a final fail the last time around,
I thought I could try to get the queue item back by reference and then check the state and use that;
but when I use the “get queue items” it says there’s no items with that reference, even thought I know it is there as it’s only getting to that point because it’s in a catch for duplicate reference.