Blue Prism RPA Product

 View Only
last person joined: 14 hours ago 

This community covers the core Blue Prism RPA product.

Debugging Code Stages - Part 1

By Eric Wilson posted 03-14-2023 15:45


Blue Prism is a highly flexible and extensible platform for Intelligent Automation. Many use cases can be addressed through the use of pre-built connectors, available on the Blue Prism Digital Exchange, or through the creation of UI models created in Application Modeler. In some cases, you may have to leverage Code stages for maximum flexibility or to integrate with custom or homegrown APIs/SDKs. In situations like this, it’s important to understand the various options for debugging your Code stages if you encounter issues with your custom code during testing.   

While Code stages are extremely flexible, they don’t provide the same level of debug capability that a full-blown Integrated Development Environment (aka IDE) like Visual Studio or VS Code do. However, there are options that can improve your debugging of Code stages. Those options include .NET’s System.Windows.Forms.MessageBox class, the open source NLog logging framework, and Visual Studio. In this post, we’re going to discuss the use of the MessageBox class from the System.Windows.Forms namespace.

System.Windows.Forms.MessageBox Class

Anyone who has written UI code for .NET is likely familiar with the System.Windows.Forms namespace and especially with the MessageBox class contained within that namespace. The MessageBox class provides a quick-and-easy solution for displaying a simple, graphical message box to the user. The developer can configure the display of the pop-up using various input parameters as well as passing in the contents of the specific message that should be displayed. This includes being able to pass in variables and have their value displayed to the user. This provides a quick and simple way to collect debugging information about your Code stages.

To use the System.Windows.Forms.MessageBox class:

1.       Open the Visual Business Object (aka VBO) that contains the Code stage(s) you intend to debug. In this example, I’ll be using the standard Utility – JSON VBO. On the Initialise tab, double click on the Information block.

2.       In the Business Object Properties dialog, click the Code Options tab.

3.       On the Code Options tab, we need to add an entry to the External References for the System.Windows.Forms.dll assembly and an entry to the Namespace Imports for the System.Windows.Forms namespace.

4.       Once you’ve added those, click OK to accept the changes. You’re now ready to make use of the MessageBox class in your Code stages.

Here’s an example of calling the static Show() method of the MessageBox class. This is the Code stage within the JSON to Collection action of the Utility – JSON VBO.

Now, when you run or step through your process from the Interactive Client, you’ll see pop-ups like this:

It’s as simple as that!

If you want to include any of your variable values, simply append them to the content of the Show() method using standard C#/VB language features.

C# Example:

MessageBox.Show(“This is the value: “ + MyVariableName);

NOTE: Before moving a VBO from your test environment to production, make sure to remove any calls to MessageBox.Show(). Otherwise, your process will block each time that method is called.

In future blog posts, we’ll discuss the use of the open source NLog logging framework and how to leverage Visual Studio or VS Code to make your testing and debugging life easier.



05-18-2023 14:42

Good idea. Thanks Eric for sharing this.

05-11-2023 05:21

Thanks @Eric Wilson  for the detailed explanation.  looking forward for part2

03-21-2023 11:46

Thank you @Eric Wilson for sharing this information.

03-15-2023 14:55

thanks @Eric Wilson  for sharing this !!

03-15-2023 10:11

Thanks for sharing a detailed approach, worth reading @Eric Wilson

Recommended For You

This content has been recommended for you based on your profile information (e.g. no. of digital workers & experience)

Please update your profile information to view recommended content

Welcome to the Blue Prism RPA Product Community!

Whether you’re looking to manage a complex infrastructure, maintain security and compliance, bring new products to market faster, or gain operational speed and agility in an uncertain economy, Blue Prism delivers — with the flexibility you need to create the business you want. From deployment on-premise, through a cloud service provider or as SaaS, to a skillful and adaptable digital workforce that continually expands to meet your enterprise needs, you can gain enhanced operational insight and control while your people reclaim the time they need to focus on great work.

Product PageKnowledge BaseBlue Prism Training Offering
Product Research ProgramUpdates, Releases & Announcements


Blue Prism is intelligent automation — business-developed, no-code automation that pushes the boundaries of robotic process automation (RPA) to deliver value across any business process in a connected enterprise.

A combination of RPA with expanded cognitive and AI capabilities, Blue Prism is different than other automation technology on the market. With one Blue Prism license, you gain instant access to an already AI equipped digital workforce, along with the tools you need to build and delegate automations. Click here for more information on Blue Prism and Intelligent Automation.
To learn more about how Blue Prism RPA can help your organization and how much it will cost to get started, please Contact our Sales department.
Blue Prism RPA can be downloaded from our customer portal. If you would like to consume or download any material it is necessary to create an account on the Portal. Once you have registered, you can access the download options for Blue Prism here.
Yes! Installed on your own machine and supported by our training materials and product documentation, you can use all the features of the full enterprise product for free with our Blue Prism Trial – giving you the opportunity to learn the basics before moving to a full production implementation. Click here for more information and to download the trial.
Yes! You can access our known issue list for Blue Prism from our Support Portal.
Regardless of your industry, Blue Prism’s Digital Workforce can adhere to strict governance and compliance standards without limiting productivity. Click here for more information on how your industry can benefit from Blue Prism.