hey i'm cameron mckenzie at cameronmcnz on twitter and i want to talk to you about uipath
queue transactions now what i want to show you was how to handle queue items transactionally
and specifically how to set their status from new in this case i'll set them to successful
there's a couple of things that go into doing this so to show you how you do this from scratch
what i'm going to do in this tutorial is i'm going to first create the uipath queue in orchestrator
then i'm going to write to that with a really simple application in studio and then i'm going
to create another orchestrator project in studio and then read that data off the queue
and as i read the data off the queue i'm going to create a transaction and then i'm going to
set the status of each of these transactions to successful so that's kind of comes at the
end so it's a 10 minute tutorial not too long but if you just want to specifically look at
that portion probably want to look at the eight and a half minute mark but i think if you watch
the whole tutorial you'll get a really good idea of how cues work and transactions work in uipath
and uipath studio so if you want to work with cues the first thing you need to do is create a
queue and i'm here in orchestratorcloud.uipath.com you click on automations queue and then you just
click the plus button and name your queue so i'll call it the insights queue and then you
can add a description if you really want do you want a unique reference this will allow you to
make sure that only specific requests go to this queue specify your auto retry but i just want to
demonstrate the basics here so i'm just going to create this very very basic queue so the queue
has now been created and then the question is how do you actually write to that queue well
it really couldn't be easier all you have to do is go into ui path studio and create a new
orchestration process don't create a process create an orchestration process because the
default process won't work and i'll call this add message to queue that'll be the name of my project
i'll open the main window and i'm going to search over here for the add cue item and get reference
so i'll move this over here i didn't do the connection so let's connect these two
up that looks nice and handsome and then over here i just double click and i specify all of the
different properties that i need so double click to open it up there we go and now it wants the
cue name and of course the queue name just maps to insights queue that needs to be in quotations
normal priority i'll give it high priority and then you can have an expression to
save the output too i'm not going to worry about that now but i am going to worry about
what i actually put into this queue and you can see this collection here you can code it in so i
could say you know email and the value is mail at mcnz.com and then we could have a priority
actually i don't want to say priority because that would confuse us with the q priorities so i'll say
status and maybe this person is diamond status and then maybe we could have you know interests
and then maybe their interest is uipath
and there we go let's take a look at that
i got one extra one there that'll just delete okay now this looks handsome so email status and
interest and so that's been set to the collection and i can just now save that and click the run
button it'll just take a moment to run notice that it started and it finished and now with
that completed i can head over to uipath there's my queue i'm going to take a look at that queue
view transactions and you see that there's one new transaction here that's the one that i just wrote
and if i take a look at the details on that you notice that the email the status and the interest
are all configured there so diamond uipath mail at mcnz which is exactly what i configured here
in the collection where it actually says collection so i just click on this and
there you go email status interests and so that's all been pushed up to the server
now how would you read that well that's just done in a new uipath studio project so i'm going to go
home i'm going to close this project and i'm going to create a new orchestrator process and i'm going
to call it process queue items and then when this starts up i'm going to open the main window and
i'm going to look for the activity called get cue items there it is right there i'm going to
drop it in and this get cue items it needs to know the cue name and of course that was insights queue
and that's just the name of the queue over here insights queue no big mystery there
and when this get queue items runs it wants to take all of the items in the queue and hold
it into a variable so i just highlight in the variable there and press control k a little set
var comes up which is going to allow it to set the appropriate type and i'm just going to call this
get q items output and i'm going to need that in a moment so i'm going to just copy that as
i create it but that gets created then you can see down here in the variables gets created and it's a
type i innumerable with a collection of cue items inside of it and when you have a loop
it's a good idea to just loop through it or when you have an iterable object it's a good idea
to loop through it so over here i'm going to loop through that with a four each i'm going to just go
for each of the elements inside this queue so i'll put it down there we've got a four each and i'm
going to double click on this and so for each item in well what was that that was each item in the
get queue items output click control s there what do i want to do well maybe i'll just want to get
the information that's in the queue so how do you actually get details of that item so we've got one
item in the queue here if we view transactions and then even take a look at this and view the details
you notice that we've got the status and the email how do we actually pull those properties out
well inside the body of this for loop here i'm just going to add a right message
much better than the left message right line
and then in this right line i'm just going to say well each cue item is
listed as an item so i'm going to say item dot
specific content and just ask for the email
and of course this is actually giving me a little warning here and the reason
for the warning is in that for each loop you'll notice up here that the argument type is object
i actually want that argument type to be cue item because that's what's inside of that list
and there you go right under uipath core cue item
click control s then just verify down here that we've got the tostring
and i'll just kind of take that put it into notepad
and there you go you can actually see the whole content of that line there
so i'm going to click control s here i'm going to give this little run
and you notice that as it runs it's actually pulled that information out mail.mcnz.com so
that's how easy it is to just pull data out of the queue i can even copy that
copy that and paste it in
paste it in right there and then of course the
other fields that we've got is status so you know maybe just pull out status as well
and give it another run
you notice we've got diamond and mail at mcnz so let's say i actually pull out the
fields inside of that queue but notice that the object's still in the queue right so its status
is new how do you actually change the status and actually handle it so no one else is going to
handle it right once somebody's handled something in the queue you don't want it handled again
well what you do there is you just get the transaction item
so we just look for the get transaction item activity over here there it is just pull it in
it's going to ask for the name of the queue and of course the queue we can find that out right over
here it's the same one hasn't changed so it's the insights queue put that in quotes here and
then have an output for the transaction item so where do we want to store that variable again ctrl
k will allow us to highlight there press ctrl k allow us to set a variable and just very boringly
call it transaction item now that creates the variable that we need you can see it down there
and now with the transaction item available to us we can simply go over here and just
say hey we want to change that transaction status so set transaction status here we go
and then we would what do we want to set the transaction status to you can choose i
want to set mine to successful and of course it wants to know what transaction item we're
talking about and we're just talking about this one here the transaction item i just created
and there you go that now allows us to not only get the information out of the transaction
but actually get get the information out of the queue but also get the transaction item and then
change the status on the object in the queue so i'll click control s there click run we get the
information then we actually start a transaction we end it and it seems like it processed the queue
so did it really well let's go take a look at our queue so over here here's our insights queue
i'll take a look at it so take a look at the transactions
and now you notice this transaction that previously was new
has now been marked as successful and there you go that's how you handle your transactions in
uipath orchestrator and there you go that's everything you need to know about uipath queue
transactions well maybe not everything you need to know but it certainly gets you started on your
journey towards managing transactions in uipath if you enjoyed that tutorial why don't you head over
to the theserverside.com i'm the editor-in-chief over there love to have you i've got lots of great
tutorials on devops automation enterprise software development in general if you're
interested in my personal antics you can follow me on twitter at cameronmcnz and subscribe on youtube