Introduction
When I embarked on my latest project involving MuleSoft's Robotic Process Automation (RPA), little did I know it would be one of the most challenging yet rewarding experiences of my professional journey. As someone who enjoys solving complex puzzles, I was eager to dive into the intricacies of RPA; however, I soon realised this project would test my skills and patience in ways I hadn't anticipated. Balancing work and personal life became crucial, as late nights and early mornings became routine. However, with a steadfast commitment to overcoming each obstacle, the end result was immensely satisfying.
Understanding MuleSoft RPA
MuleSoft RPA is a relatively new technology that, while promising, still has some limitations. That being said, I am confident these constraints will be addressed as the technology continues to evolve. For those unfamiliar, MuleSoft RPA is a no-code tool designed to automate human tasks. It excels as a hyperautomation technology, especially when used alongside MuleSoft Composer, APIs and Salesforce flows.
Key applications of MuleSoft RPA
MuleSoft RPA comprises four primary applications:
- RPA Builder (On-premise)
- RPA Recorder (On-premise)
- RPA Bot (On-premise)
- RPA Manager (Cloud-based)
Focusing on RPA Builder
RPA Builder is where all the development occurs, and it is the application I’ll be focusing on today. RPA Builder offers various tools for reading, writing and extracting data from documents, text files, Excel files and more.
Case study
Recently, I encountered a limitation while using an Excel controlled loop to match a cell with a regex value.
Standard approach
Typically, to match a regex with a cell, you would open an Excel controlled loop within an Excel session to iterate through each cell until a match is found. You would set up the fields as shown below:
Image 1: Excel session (with dynamic values)
Encountering the issue
If the sheet name is made dynamic as opposed to static, an error occurs. The error message, "The number of columns defined at design time differs from the number of columns at execution time," indicates that if Sheet1 has, say, 9 columns during the preview (depicted in Image 2). Now, if we expect the loop to run over different sheets to get the desired output, we make the Sheet name field dynamic (depicted in Image 3). If in the next run, let's say, Sheet2 gets picked up which has a different number of columns when compared to Sheet1, the Excel controlled loop fails to load and it throws the error as depicted in Images 4 and 5 below:
Image 2: Excel controlled Loop (with static sheet name)
Image 3: Excel controlled Loop (with dynamic sheet name)
Image 4: Excel controlled Loop Errors out (when sheet name is dynamic)
Image 5: Error detail
Solution
To resolve the error message "The number of columns defined at design time differs from the number of columns at execution time," I found that you can run a regular loop through rows with a nested loop through columns. As soon as the regex matches, you exit both loops, thereby identifying the row number where the regex matched the cell value as shown below:
Image 6: Solution
Conclusion
Working with MuleSoft RPA has been an enlightening experience. While there are challenges, the rewards of successfully automating complex tasks make it worthwhile. I look forward to seeing how MuleSoft RPA evolves and continues to simplify and enhance automation processes.
Have you worked with MuleSoft RPA or encountered similar issues? Share your experiences and solutions in the comments below!
FAQs
What is MuleSoft RPA?
MuleSoft RPA is a no-code tool designed to automate human tasks and streamline processes.
What are the primary applications of MuleSoft RPA?
The primary applications are RPA Builder, RPA Recorder, RPA Bot, and RPA Manager.
How does RPA Builder help in automating tasks?
RPA Builder offers tools for reading, writing, and extracting data from various document types, making task automation easier.
What are common issues faced while using Excel controlled loops in MuleSoft RPA?
Common issues include errors when using dynamic sheet names due to differing column numbers at design and execution times.
How can one resolve issues with Excel controlled loops in MuleSoft RPA?
One solution is to use regular loops through rows with nested loops through columns, exiting both loops upon matching the desired condition.