Skip to main content
Free Agentforce workshops and AI Certifications: Learn more. Terms and conditions apply.

Use Conditional Tests to Verify Automated Step Results

Learning Objectives

After completing this unit, you’ll be able to:

  • Set the value of an activity parameter.
  • Use a Control Block to add logic to your flow.

In this module, you’ve learned how to automate dynamic interactions with a Windows program, make automated GUI searches more robust by using dynamic values, and automate secure logins by using an RPA process. These units reinforced and strengthened the foundational skills, concepts, and tools introduced in the previous module. Now, you learn how to verify results of automated steps by using conditional tests.

This unit uses many common programming concepts and may come easier to someone with a programming background. However, you don’t need a programming background to understand the concepts introduced in this unit. If you don’t have a programming background, it may be helpful to continue with this unit but pair with an RPA developer during your first RPA process implementation project.

In this unit, you continue the case study from the previous units in this module. You code a workflow to set a variable to use in the conditional tests in a Gateway element. You decide if the RPA process should RSVP to a Virtual Meetup event or if the flow should skip the RSVP steps and go directly to a cleanup RPA Bot Task. 

Branch Conditionally Between Different Paths in a BPMN Flow

Whether simple or complex, a key function of programming is being able to take different actions in different scenarios. This is often referred to as conditional branching.

In our example, we only want to RSVP to an event if we haven’t already. If we’ve already RSVP’d, we proceed to the cleanup step. In the cleanup step, you may want to log out of an account if you are currently logged in. If we haven’t RSVP’d, we must proceed to the RSVP step and then add the event to our calendar.

You may remember from the very beginning of the build phase, we used an Exclusive Gateway to determine whether to manually start the flow. We use an Exclusive Gateway again in this case.

Use a Set Variable Action Step

The Set Variable action step allows you to set the value for an activity parameter. The modified value will be available in all other action steps.

Use a Managed Block to Control Logical Flow

The final tool you need is the Managed Block. The Managed Block acts similarly to a Try/Catch block in Java, C#, and the Try in Mule 4.

Understand DoAction, OnError, and DoAlways

The Managed Block consists of three sections: DoAction, OnError, and DoAlways.

The DoAction section is where action steps are executed. If all steps execute successfully, the process moves forward as usual.

If any of the steps fail, every step following the failed step halts and the OnError section is executed. It’s here that we use the Set Variable action step to set the new activity parameter so the Exclusive Gateway knows which path to take.

The final section of the Managed Block is the DoAlways section. Any action steps in this section are executed regardless of whether there’s a failure in the DoAction section.

Walkthrough

Now that you’ve learned how to work with conditional branching, take a look at the following video demonstration showing how to put this into practice. If you wish to follow along, check out the walkthrough instructions

Cleanup from the Walkthrough

When you finish the walkthrough, be sure to follow the cleanup instructions to un-RSVP from any MuleSoft Meetup events that you do not intend to actually attend. Take a look at the following video demonstration showing these cleanup steps.

Note

As a good MuleSoft Community member, it’s very important that you un-RSVP to any MuleSoft Meetup event that you do not actually intend to attend.

Wrap It Up

In this module, you learned some more advanced techniques and tools to make your RPA processes more secure, robust, and dynamic. You got more experience creating anchor points, and then automating mouse clicks and keystrokes relative to anchor points. You also learned how to bind an activity parameter to an OCR action step to create an anchor point from dynamic text. You then learned to pass this in from a manual User Task or in the deployment configuration when the RPA process is deployed to an RPA Bot instance.

Additionally, you learned how to handle secure passwords to log in to a website. You also learned how to use more sophisticated programming patterns to conditionally branch in an Exclusive Gateway and handle errors in a Managed Block. In the walkthroughs, you used the Managed Block to conditionally check if the Un-RSVP string appears in the webpage. You then learned to take conditional action when the MuleSoft Virtual Meetup event already RSVP’d for the MuleSoft Community user versus when it still needs to be RSVP’d.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback