Getting activity Context for Argument.set method

Hi Uipathians,

I’m currently in the process of trying to create a generic Queue uploader for my team. This should allow us to send any CSV to a queue without having to configure the Item Collection part of the Add Queue item activity each time. Part of this is that I need to dynamically set the values of the item Collection by creating a new inargument variable.

I set the key using the header of my current datatable and then I set the inargument variable by using

inargument.create(oftype(string),argumentdirection.in).set( ActivityContext Required here,item)

This all seems to make sense to me aside from the activity context. Googling this gets me a lot of results about authoring new workflows but nothing dynamic so i’m wondering if this can be set? or got from somewhere?

i would appreciate any help/suggestions on fixing this.

(Using a switch and then multiple Add Queue Item activities is an option but ideally not an option we want to go for)

Thanks

Have you considered putting a serialized version of it in the queue as 1 inargument and deserializing on get?
Other option would be to build the activity on runtime and use WorkflowInvoker.Invoke, but I can’t check now if this is feasible.

Edit:
@jakelewis18
Going the route of building the InArguments dict was irritating, but I think I got what you need using Orchestrator HTTP request from 2018.1 (and very ugly string formatting, but it should get you going), see attached file.
Since the only variable part (as far as I understood your requirement) would be DT content and queue name, it’s just a matter of putting them in the payload.
AddDynamicQueueItemsTest.xaml (15.5 KB)

2 Likes

Any idea how to get the current ActivityContext asked by the OP? I failed at this point in the past as well.

inargument.create(oftype(string),argumentdirection.in).set( ActivityContext Required here,item)

This is interesting, although it doesn’t work for me in 2017.1.

image

This activity is available from 2018 only unfortunately.

For getting the context - no idea to be honest. Will post if I find a way.

oooo that seems interesting… thanks for looking into this. I’m going to see if we can upgrade to 2018.1 asap so I can test this out. Thankfully other parts of our project require it as well so shouldn’t be long.

Thanks for all the help, been banging my head against a wall trying to figure this out.

If you can’t upgrade or it will get stuck, you can do the same with normal rest calls, you’ll just need to add the authentication part before (lookup forums, there should be examples for that).

Good luck!

1 Like