In our previous topic, we learnt about how to emulate the message box property using Blue prism which would enable to send popup messages to the user on run time resources . It pauses the execution until someone manually clicks on the OK Button.
You can read the post here.
Message Box and Request Credentials Using Blue Prism (Attended Automation)
In this post, we will learn about how to take user inputs during run time using Blue Prism.
Assumption:
1- You are familiar with basics of adding name spaces and dlls.
2- Basic understanding of how code stage works
3- Basic understanding of where to input global codes and how to call the global functions.
You can also refer to the post link given above to get those details.
You have to follow the same principles as described in the above article and add a new global code with the below snippet.
Code for Taking one input in the dialogue box:
private static string inputDialog(string fieldname)
{
System.Drawing.Size size = new System.Drawing.Size(200, 70);
Form inputBox = new Form();
string input=”Enter “+fieldname+” here…”;
inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
inputBox.ClientSize = size;
inputBox.Text = fieldname;
System.Windows.Forms.TextBox textBox = new TextBox();
textBox.Size = new System.Drawing.Size(size.Width – 10, 23);
textBox.Location = new System.Drawing.Point(5, 5);
textBox.Text = input;
inputBox.Controls.Add(textBox);
Button okButton = new Button();
okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
okButton.Name = “okButton”;
okButton.Size = new System.Drawing.Size(75, 23);
okButton.Text = “&OK”;
okButton.Location = new System.Drawing.Point(size.Width – 80 – 80, 39);
inputBox.Controls.Add(okButton);
Button cancelButton = new Button();
cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelButton.Name = “cancelButton”;
cancelButton.Size = new System.Drawing.Size(75, 23);
cancelButton.Text = “&Cancel”;
cancelButton.Location = new System.Drawing.Point(size.Width – 80, 39);
inputBox.Controls.Add(cancelButton);
inputBox.AcceptButton = okButton;
inputBox.CancelButton = cancelButton;
DialogResult result = inputBox.ShowDialog();
input = textBox.Text;
string output = input.ToString();
return output;
}
Initialize Page Global Code will look like:
Now you can call this function “inputDialog” with one string type input argument to display the field name. It will return a string value which is the user keyed in value.
The Code in action stage will look like :
The Input Dialogue Box will look as below:
Value Returned will be stored in the result variable.
Download Link:
Happy learning.

An RPA/IPA enthusiast, having 10+ years of rich industry experience.
Tools Expertise : Blue Prism, UiPath, WinAutomation, Intellibot, Kofax RPA (Kapow)