cancel
Showing results for 
Search instead for 
Did you mean: 

Blue Prism - Issue with setting parameters using C#

VarindaS_
Level 4
Hello,
 
I am working on a code stage in Blue Prism using C#. I am passing one number data item "UserCapacity" and three collections and getting Result as an output.
 
35987.png
For the "UserCapacity", I tried following approaches.
 
int userCapacity = Convert.ToInt32(GlobalContext.GetParameter("UserCapacity")); //this did not work
 
int userCapacity = Convert.ToInt32("UserCapacity"); //this worked
 
35988.png
 
For collection, I am trying to set the collection "ExistingTasks" as Lists. I am facing issue with GlobalContext. I have tried using BluePrism.Interop.GlobalContext but it won't work.
 
List<Dictionary<string, object>> existingTasksData = (List<Dictionary<string, object>>)GlobalContext.GetParameter("ExistingTasks");
 
35989.png
 
If I set it like below, I get error, "Cannot convert type 'System.Data.DataTable' to 'System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, object>>"
 
List<Dictionary<string, object>> existingTasksData = (List<Dictionary<string, object>>) ExistingTasks;
Please let me know what can I do to resolve this and how to set parameters correctly. I have attached the images for input, output, code, references and namespaces. 
35990.png
2 REPLIES 2

Hi varinda,

 You already defined UserCapacity data item as a number in input parameter

if you want to  pass that  in the code stage  then you can do some thing like below
int userCapacity = Convert.ToInt32(UserCapacity) 
You can try with out quotes since UserCapacity  is defined as input parameter.
 

-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri

VarindaS_
Level 4

Hi Harish,

I can do it for number variable.

However, for collection, I cannot convert type from DataType to List. Hence, the issue.

List<Dictionary<string, object>> existingTasksData = (List<Dictionary<string, object>>)GlobalContext.GetParameter("ExistingTasks");