cancel
Showing results for 
Search instead for 
Did you mean: 

Calling an VBO action in code stage

antonio-r-melo
Level 3

Hi All,

I need to call diferente VBO Actions dinamically, can I do it by a code stage? Something like the code below, sugested by chatGPT? (can't put this code to work beacause don't know how to declare (using BluePrismAPI and witch dll to import)
Where can I found some documentation about BluePrismAPI / BPObject class?

Thanks for your help!

 

using BluePrismAPI;

 

//Create a reference to the Blue Prism API

BPObject bpObject = new BPObject();

 

//Connect to the Blue Prism environment

bpObject.Connect(@"localhost");

 

//Start the object – PS: Process name should be action name???

bpObject.Start("Object Name", "Process Name");

 

//Pass data to the object as inputs

bpObject.Set("Input Name", "Input Value");

 

//Execute the object

bpObject.Execute();

 

//Get the output from the object

string output = bpObject.Get("Output Name").ToString();

 

//Disconnect from the Blue Prism environment

bpObject.Disconnect();

 

5 REPLIES 5

PvD_SE
Level 12
Hi Antonio,

Nice, another example of ChatGPT being used in a BP case!

The generated code seems merely an example to me, not real code for actually doing something in BP. As someone clearly demonstrated here, I wouldn't yet let ChatGPT do my businesss coding.

If we ignore the ChatGPT code for a minute, and you tell us what you are trying to do, then I'm sure we (the community) can point you in the right direction. 

So, in short:
  • What do you mean by calling VBO's dynamically?
  • From where do you want to call the VBO's?
  • What are you trying to accomplish?


Happy coding!
---------------
Paul
Sweden
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

antonio-r-melo
Level 3
Hi @Paul JHM van Doorn

Thanks for your feedback, just for fun the question to chatGPT was "How can I call a blueprism object from a code stage?", It gives me unusable code, but I think it was a cleaver answer.

I am trying to do some generic process for all my robots, so I can implement comom functions only once. I want in the execution call an VBO to do the loading of itens, one to do the execution of the RPA, and write the result to da new working queue, and another one for reporting back to the bussiness personal of RPA results.

So basically I need to call my VBO action by the name read from a config file. I don't know if is possible to call and action dinamically by its name in code stage (or global code function).

Thanks for your help.

António


PvD_SE
Level 12
Hi Antonio,

Interesting concept - a general process for all, steered by a parameter config file. Keep us posted on that one!

Instead of doing a lot of coding outside of BP, I'd look into setting up a config file in a suitable format (text, XML, XL, ...) that holds the info for configuring and running the process.

In general, when coding something for the first time, you should ask yourself already if this piece of code would have a potential reuse in other processes. If the answer is Yes (or even Maybe), then it should be split off in either an object or a sub-process.
If the answer was no, but you find yourself coding the same thing later anyway, then again, it should be split off in either an object or a sub-process, followed by implementing the plit-off code in both processes.
Ignoring this principle will make you end up with duplicate code in several BP processes and will eventually catch up with the developer as the code has to be adjusted to a new reality. If then the code is still held in place and not split off, it is time to look for another developer.


Happy coding!
---------------
Paul
Sweden
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

antonio-r-melo
Level 3
Hi,

Wise words without any doubt, thanks for your reply.

I will look for BP support to know if is possible to call an object action dinamically by c# code.

If I can I will post here the solution.

Regards,
António

Hi @antonio-r-melo - Did you find a solution for your usecase ? I have similar scenario where I want to call 50 actions depending on a input parameter but I do not want code all 50 scenarios using a decision box.. instead I want to maintain a collection with 50 action names ("object name" and "action") and pass it as an input  to one action which can call the required actions, which will reduce the coding efforts significantly. Would you appreciate if you can respond.

Thank you in advance !