UiPath Nested If Then Else Example |Video upload date:  · Duration: PT7M16S  · Language: EN

Learn to build nested If Then Else workflows in UiPath with step by step guidance and practical tips for handling multiple conditions

Why nested If Then Else matters in UiPath

If you need a few branches of logic without turning your workflow into a maze, nested If Then Else is the polite option. It is great for grading systems, multi stage approvals, and any conditional logic that depends on a previous decision. Use it when you want compact branching and quick results in Studio.

Prepare your variables and sample data

Name your variables like a grown up. Use names such as score or status so no one has to guess what var1 means. Add sample data to test edge cases and to avoid debugging sessions that feel like séance work.

Basic nested pattern

Add a first If activity to check the primary condition. Then nest a second If inside the Then or Else branch to refine the decision. A simple example in UiPath terms looks like this.

If score > 80 Then
    Log Message "Top tier"
Else
    If score >= 50 Then
        Log Message "Mid tier"
    Else
        Log Message "Low tier"
    End If
End If

Practical steps to implement

  • Step one set up variables with clear names and types like Int32 for score and String for status
  • Step two drag an If activity and enter a readable expression such as score > 80
  • Step three nest a second If inside the Then or Else branch depending on your logic
  • Step four add Log Message activities to every branch so the run history tells a story
  • Step five run tests with boundary values and unexpected inputs and add default handling for safety

Logging and readability tips

Every branch should log what happened and why. Use messages like Branch fired Top tier for score 92 so a single go does not force you to replay the whole world. Keep expressions short and readable. If your condition needs a novel to explain it you are doing it wrong.

When to stop nesting and pick another tool

Nested If Then Else is neat up to about two levels. If you find yourself piling on more checks consider switching to a Switch activity or move complex paths into separate workflows that you call from the main flow. Modularization is not surrender. It is pragmatic survival.

Testing and edge cases

Test boundary numbers like 80 and 50 and bad inputs such as null or empty strings. Provide a default branch or a fallback assignment so the workflow does not crash unexpectedly. Good error handling saves time and reputations.

Quick recap and best practices

  • Use descriptive variable names and short expressions
  • Log each branch so you can tell which path ran without guessing
  • Limit nested levels and prefer Switch or invoked workflows for complex logic
  • Test thoroughly with edge cases and set default handling for unexpected values

Follow these UiPath tutorial practices and your If Then Else trees will stay readable and useful. Or at least you will be able to explain them to your future self without crying.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.