In this video, I am going to show you some strategies in combining workflows.
This will be the final video in this series.
We will put pieces of workflows to create a new workflow.
This strategy is helpful when you are building complicated workflows.
You can start building your automation workflows by creating specific ones that you can combine
later.
Let's use this workflow as our starting point.
This was created when we learned about using Flow Decisions.
If we recall, once the user entered "Bill" it will give us a message "Hello Bill".
Otherwise, it will display "You're not Bill"
Now, let's try to incorporate the calculator workflow in the current workflow.
We will run the calculator once the user entered "Bill".
There are two possible ways of attaching one workflow to another.
The first one is by using "Invoke Workflow" function in UiPath.
The second one is by saving a workflow as a template.
What's the difference between the two?
When using invoke workflow activity, the changes you will make in the invoked workflow would
be reflected in the current combined automation.
Saving the workflow as a template helps you preserve the original workflow file.
So whatever modification you made in the template, no changes will be made in the original workflow.
We often use "templates" when creating small pieces of common automation that are reusable
and applicable in multiple workflows.
So you can use templates if the workflow does not change over time.
Most common example is when you create your own reusable snippets using data, data tables
and xml files.
When creating complex UI Automation it is recommended to break it into smaller pieces
that can be tested separately and then integrate them later in a bigger workflow.
In our sample workflow we should choose the first option, Invoke Workflow.
Let’s add an Invoke Workflow activity in our current workflow.
Let's double click to open it
Now we can append this field to the path of the workflow file we want to add.
To make it simple, we can just click the ellipses button to manually find it.
That's it!
Let's go back to the main workflow.
To make it interesting, let's add some text in the message box.
Do you still remember how to concatenate a phrase, we can use a plus (+) sign and add
the phrase in quotation.
Notice that there's a space between the first quote and the first letter of the phrase?
You're right.
It will add a space between the name entered by the user and the phrase.
Let's go back to main and add an arrow in the "True" condition, next to the "Message
box".
We just combined 2 different workflows.
Let's save it.
Now we have an all new workflow.
Let's run it!
First, let's put in a wrong name "Bob"
It gives us the message box which ends the workflow.
We'll run it again.
This time, let's use the correct name which is "Bill".
It gives us the message with the name entered and the phrase we added.
Then it triggers the calculator workflow which is running through an "Invoke Workflow" activity.
Let's put in the numbers to calculate.
It completes the operation and gives us the results in the message box.
Easy isn't it?
What if we want to use a template instead?
I'm glad you asked.
Let's first open the "Calculator workflow" by going to the start menu.
In the "Recent Workflows", you will see lists of recent workflows you have been working
on.
Let's click the "Calculator" workflow.
It opens in a new tab.
In the Design tab, click the down arrow under Save.
Let's select "Save As Template"
This will be saved in the Templates folder.
Let's give it a name, let's say: Calculator.
As you can see in the Activities panel, a new "Templates" section has appeared.
Let's open it.
There is our Calculator template.
Let's go back to the main workflow we're working on.
Let's replace the "Invoke workflow" activity with the calculator template.
Let's delete the Invoke workflow first then drag the template onto the workflow.
Let's open the Calculator template.
As you can see, these are the same, exact contents of the "Calculator" workflow.
so nothing has been changed.
Whatever changes we will do in the original "Calculator" workflow, it will not be reflected
here.
Let's go back to main.
Let's see how it goes.
Let's now run the workflow.
It works good as well.
You can now save this combined workflows to a new workflow.
This video gives you an idea on how to work with complicated workflows by creating simple,
clear and understandable components of automation and combining them to achieve complete and
versatile workflows.
Thank you again for watching.
Till then.