0% found this document useful (0 votes)
6 views25 pages

Build Approval Flows in Power Automate

bai tap ve nha mon tieng viet

Uploaded by

hoangsic48
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views25 pages

Build Approval Flows in Power Automate

bai tap ve nha mon tieng viet

Uploaded by

hoangsic48
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Provide solutions to real-world

scenarios.
Completed100 XP
 1 minute

In the previous module for Power Automate, you learned how to build basic
flows that save email attachments and send you reminders from your phone.

If you're a beginner with Power Automate, this module expands your


business flow skills. If you already have some experience, this module ties
concepts together and helps fill in the gaps.

Be more productive, automatically; that's what Power Automate is all about.

Let's get started!


Simulation - Build an Approval
Request
Completed100 XP

 8 minutes

In this unit, you learn how to build a business-friendly scenario that uses
approvals.

In this scenario, anyone who has access to the SharePoint library can add a
document. When the document is created, an approval starts that allows
certain users to approve. If the document is approved, it stays in the
document library. If the document is rejected, then it is moved to a separate
folder.

Try this simulation exercise below first, and then view the detailed steps
once you complete the simulation. The simulation guides you through a
scenario resembling the steps you would use to create a document library in
SharePoint and then create a flow. You will click through the prompts, in
various sections of your screen, and you'll have a narrator to guide you
along.

Note

Select the thumbnail image below to start the lab simulation. When
complete, you can return to this page to review the steps in the simulation or
you can continue to the next unit.
.

Prerequisites

 Access to Power Automate

 A Microsoft Office 365 account with access to SharePoint

Note

You will need to create the document library in your own SharePoint tenant.

Step 1: Create a document library

First, let's create a document library in a SharePoint site.

1. On your SharePoint site home page, select + New > Document


Library > Blank library.

2. Name your library Approvals Library, and then select Create.

3. In your new document library, at the top, choose + New and


select Folder.

4. Name your folder Rejected Documents, and select Create.


Now, let's create our approval flow.

1. Next go to the Power Automate maker portal at


[Link].

2. In the Copilot text area, type When a file is created (properties


only), add a start and wait for approval action and add a condition
depending on the approval outcome.

3. Select Generate.

4. Copilot generates a flow based on the prompt provided. Copilot


may produce more than one version to consider as well.

You can continue to converse back and forth with Copilot to refine
the flow for what you want. Once you're satisfied with the
structure of the flow, select Keep it and continue.

5. Review your connections. If you aren't already connected (green


checks mean your connection's ready to go), select the 3 dots and
select Add new connection. Once your connections are properly
connected, select the Create flow button at the bottom of the
screen.

6. Select the When a file is created (properties only) trigger,


and choose your SharePoint site under Site
Address and Approvals Library under Library Name.

7. Select the Start and wait for an approval action. The


properties panel opens on the left hand side.

8. Clear the Approval type field, and then choose Approve/Reject


- First to respond from the Approval Type dropdown. (Refer to
the diagram below step 13 for reference.)

9. Update the Title field to Document Approval.

10. In the Assigned To field, enter your organization email address.


(This is for testing purposes. You can always come back and
choose a different approver later if you wish.)
11. Put your cursor in the Item Link field and select the lightning
bolt (dynamic content) button next to it. This pulls up your
dynamic content for this section.

12. Search for and select Link To Item.

13. Choose Link to item in the pop-up window.

14. Select the Condition action (below the approval) to review what
Copilot automatically selected as the condition. Ensure that
the Outcome property (or body/outcome) from the Start and wait
for an approval action is on the left and Approve is on the right.

15. Expand the condition by selecting the down pointed chevron on


the right of the action header. This will reveal
the True and False branches of the condition. Select the + icon
under the False side of the condition and choose the circled plus
sign to Add an action.

16. In the Add an action panel that appears on the left of your
screen, search for move and choose the SharePoint Move
file action.

17. Choose your SharePoint site address from the first dropdown.

18. Under File to Move, use the lightning bolt icon for dynamic
content and find and select the Identifier from the SharePoint
trigger content. (You might need to search for it.)

19. Choose the same SharePoint site for the Destination Site
Address.

20. For the Destination Folder, select the folder icon on the right
side. Find your Approvals Library, and select the arrow to the
right of its name. Then select the folder name Rejected
Documents.

21. Under If Another File Is Already There option, choose Move


with a new name.
22. Save your flow.

To test your flow, go back to your SharePoint Approvals Library and add a
new document.

After a short amount of time, an approval appears under the approvals


section of the Power Automate maker portal. If the Approvals app is
activated for your organization within Teams, you see the approval
notification pop up there. If not, Power Automate approvals is the right place
to find it.

To make sure that our flow is moving a rejected item to our Rejected
Documents folder, select the approval and choose Reject as your response.
Then return to your SharePoint Approvals Library. Refresh the browser (if
needed) and you should see the document move to the Rejected
Documents folder.

Congrats! You built an approval flow using Copilot that allows users to
approve or reject documents in a SharePoint document library.

You can easily edit or extend this approval flow to better fit your needs. Or
check out the approvals Power Automate Templates to give yourself various
starting places for your own approvals.

Simulation - Create a Business


Process Flow
Completed100 XP

 15 minutes

This unit shows how to create a business process flow using Microsoft Power
Automate. A business process flow is designed to guide a user through a
process from start to finish. Business process flows appear in Model-driven
apps.

If you're a Dynamics 365 customer/user, you can create a mobile task flow
(which won't be covered in this unit). For more about how to create a mobile
task flow, see Create a mobile task flow.

When a user starts a business process flow, the process bar at the top of the
page shows the stages and steps of the process. It's not only a progress
reference, it also ensures that any prerequisite steps are complete before
advancing to the next stage.

You can try the simulation first and then view (or complete) the detailed
steps once you complete the simulation.

Note

Select the thumbnail image to start the lab simulation. When you're done, be
sure to return to this page so you can continue learning.
.

Prerequisites

 To create business process flows, you need a Power Apps or Power


Automate per user (or Premium) license, or a Dynamics 365
license that includes business process flow use rights.

 Access to Power Automate.

 An environment with a Microsoft Dataverse database. (Applicable


only for work or school accounts).

 A table the business process flow is associated with. If the


business process flow isn't related to an existing table, create a
new table before you create the flow.

Tip

When you create a business process flow definition, you can define who has
privileges to create, read, update, or delete instances of the business
process flow. For example, for service-related processes, you might give
customer service reps full access to change the business process flow
instance. But you might give sales reps just read-only access to the instance,
so that they can monitor post-sales activities for their customers. To set
security for a business process flow definition that you create, select Enable
Security Roles on the action bar.

Create a business process flow


Important

As of August 2022, you can no longer create or manage business process


flows from Power Automate outside of the solution explorer. Business
process flows and instances continue to be supported through the solution
explorer, Power Apps, and Dataverse table views.

1. Launch Power Automate and sign in using your organizational


account.

2. In the left pane, select Solutions.

3. You can either select an existing Solution or create a new one.

4. Inside the solution select + New, Automation, Process, and


then Business process flow.

5. In the Build a business process flow pane, fill in the required


fields:

 Display name: The display name of the process


doesn't have to be unique, but it should be meaningful
for people who must choose a process. You can change
this name later.

 Name: A unique name based on the display name. You


can change the name when you create the process, but
you can't change it after the process is created. Power
Automate can generate this for you.

 Table: Select the Microsoft Dataverse Table on which


to base the process.

The Table that you select affects the fields that are available for
steps that can be added to the first stage of the process flow. If
you can't find the table that you want, make sure that
the Business process flows (fields will be created) option is
set for the table in the table definition. You can't change the table
after you save the process. In our example, we use the 'Account'
table which is a standard Dataverse table.

6. Select Create and wait for Power Automate to create your new
process in the solution.

7. Select the business process flow you created from the solution
menu. Power Automate opens a new browser tab to edit it.

8. The business process flow (BPF) designer is now on your screen.


The designer page has three sections:

 On the left, a single stage named [Your table name]


New Stage was created for you. (In our image below,
we use the Account table.)

 Beneath this stage is the mini map, which is a visual


navigator for your BPF that lets you see the whole
process or quickly go to a part of the process. The mini
map toggle icon expands and contracts the map. With
just one step in your process, the map will just show a
"stage" icon filling a small portion in the top left corner
of the map and a grey background filling the rest of the
map.

 On the right side of your screen is a panel depicting BPF


components. This two-tabbed panel allows you to drag
and drop components into the BPF from
the Components tab. The Properties tab shows
properties of the first (if you haven't selected a stage)
or the selected stage. When you select any stage in
your BPF, the properties of that stage appear in this
panel.

If you add any components that you later decide you don't want to
include in the BPF, you can delete them simply by selecting the
component or detail and then selecting the Delete button in the
editor header.

9. Add stages so that users can proceed from one business stage to
another in the process:

a. Drag a Stage component from the Components tab to the


designer canvas. Notice a plus sign (+) in a dashed rectangle
appears to the right of the initial stage. Drop the new stage into
the plus sign rectangle to anchor it onto the canvas. Upon
completion, you now have two stages in your BPF.

b. Select the new stage, and then, on the Properties tab on the
right, set the properties:

i. Enter a stage Display Name.

ii. Optional: Select a Category from the dropdown for the


stage (for example, Qualify or Develop).

This category appears as a chevron on the


process bar in your model-driven app. It will not
appear here.

iii. When you finish setting the properties,


select Apply.

10. Steps in each stage can entail multiple fields of data entry (one
Data Step per field), as well as Workflows, Actions, and (Power
Automate) Flows. Let's add a Data step to this stage with the
following actions:

Tip

To see the steps in a stage, select Details in the lower-right


corner of the stage.

a. Tab to the Components in the right side panel and drag a Data
Step component to the first stage and drop it there. Your BPF
should now resemble the image below.
b. Next we define what we want the user to do with the data. Select
the first Data Step (Data Step #1) in the stage and set the
properties as follows:

i. Enter a Step Name (up to you).

ii. Define a Data Field your user fills out.

iii. If you want users to fill in the selected field to finish the
step before they can proceed to the next stage of the
process, select Required.

iv. At this point, you can leave the Sequence as 1,


but you see how when you add other Data Steps,
you can adjust this number. When you adjust this
number, Power Apps automatically adjusts the
other Data Steps accordingly. You can also
simply drag and drop to adjust the order of steps
within the stage, and the BPF editor will
automatically adjust the Sequence.

v. When you finish, select Apply. Your Data Step


displays the changes to the Step Name as well as
the selected Data Field from your table.

11. Add a Condition to the process:

a. Switch your panel back to Components and drag


a Condition component to the plus sign (+) box between two
stages and drop it there. In other words, at this point, based on
data input in the first stage, we create a condition that affects
how we proceed in the BPF. The Condition expects a Stage for
both outcomes. You can't validate the BCF without a stage for
true and a stage for false. (Don't be confused by the line
connecting the true side with the next stage.)

b. With your new condition selected, look at the Properties panel


and set the desired properties under the Rules section,
according to your data. When you finish, select Apply.

c. Notice that your condition includes a green box check


representing the course of your BPF if the condition is true, and
an orange box representing the course if condition is false. Add a
new stage, by dragging and dropping from the Components,
under the orange box.

d. Adjust the Display Name, Category, and Entity (or table) and
select Apply.

e. Select the Components tab and drag and drop another Stage to
the "green check" side of the condition.

f. Adjust the Display Name, Category, and Entity for this stage and
select Apply.

Notice how both stages line up in the same column of


your BPF. That's because they're considered to be in the
same Category of your BPF. The Condition simply
represents a branching option for the Category, so they
can include separate Data Steps, flows or actions.

12. Add a workflow to the process:

a. You can add an existing workflow, or you can create a new


workflow to add to your BPF via the Workflow component.
However, Microsoft is continuing to develop the Power Automate
flow step (currently in preview) as an option to add a workflow. A
Workflow is a legacy feature that many organizations still use,
but it doesn't use a modern interface, whereas a Power
Automate flow performs similar actions and has a modern
interface.

There are two options for adding a workflow to your BPF.


You can drag a Workflow component from
the Components tab to either a specific stage or
the Global Workflow item (in the bottom right corner of
the screen):

 Drag the Workflow component to a specific


stage if the workflow should be triggered when
the process enters or exits that stage. The
Workflow component must be based on the
same primary table as the stage. You'll see it
under the Triggered Process section of the
stage.

 Drag the Workflow component to the Global


Workflow item if the workflow should be
triggered when the process is activated or
archived (that is, when the status changes
to Completed or Abandoned). The Workflow
component must be based on the same
primary table as the process.

b. Notice that you must use or create an active, on-demand


workflow made for the same table as the one used in this stage.
Select the Workflow process, and then, on the Properties tab,
set the properties:

i. Enter a display name.

ii. Select when the workflow should be triggered


(Stage entry or Stage exit).

iii. Search for an existing on-demand active


workflow that matches the stage table.

It is beyond the scope of this exercise to create a


new workflow. If you want to learn how to create
one, see Dataverse workflows (listed under
"Classic Dataverse").

iv. When you finish, select Apply.

13. Validation of your BPF verifies completion of all of your stages


and alerts you to where you need to make adjustments. It's a
means of error checking. To validate the business process flow,
select Validate on the action bar. If errors exit, you'll see a
header error message in red text with the total number of errors,
and each stage or condition will show an error message with the
number of errors in that stage/condition.

At this point, you can select each Stage/Condition individually and


try to resolve the errors. For example, if you added a 'Workflow'
process but didn't have a selected workflow, simply select the
'Workflow' under your stage and select the Delete button on the
Command Bar.

As you work through the errors, the red error messages disappear.

14. You don't have to resolve all of the errors before saving your
BPF, if you need to save it prior to completing the validation. To
save the process as a draft while you continue to work on it,
select Save on the action bar.
Important

No one can use a BPF while it's a draft.

15. Once you've validated your BPF, the Activate button in your
action bar becomes enabled, and you can activate the BPF for use
in your model-driven apps. To activate the process and make it
available to your team, select Activate on the action bar.

After a few moments, the loading dialog disappears, and you'll


notice a Deactivate button on the action bar. If required, at any
time you can select this button to remove this BPF's availability to
your team. It doesn't delete the BPF; it merely puts it in stand-by.

16. To define who has privileges to create, read, update, or delete


the business process flow instance, select Edit Security Roles on
the action bar. For example, for service-related processes, you
might give customer service reps full access to change the
business process flow instance. But you might give sales reps
read-only access to the instance, so that they can monitor post-
sales activities for their customers.

a. In the Security Roles pane, select the name of a role to open


the details page for that role.

b. Select the Business Process Flows tab, then select the options
to assign the role appropriate CRUD privileges for the business
process flow. The option buttons behave like "radio buttons" and
are either selected (filled with green) or not (unfilled circle with
red outline).

Note

By default, the System Administrator and System


Customizer security roles have access to new business
process flows.
c. Select Save.

Tip

Keep these tips in mind as you work on your business process flow in the
designer:

 To take a snapshot of everything in the business process flow


designer, select Snapshot on the action bar, which downloads a
"png" file of your BPF into the "Downloads" folder of your browser.
This option is useful if you want to share and get comments about
the process from a team member.

 Use the mini map to quickly go to different parts of the process.


This option is useful when you have a complicated process that
scrolls off the screen.

 To add a description of the business process, select the down


arrow immediately to the right of the process name in the upper-
left corner of the page. You can enter up to 2,000 characters in
the description field.

When you're finished with the BPF editor, simply close the browser tab to
return to your Solution objects.

Edit a business process flow

You can edit the business process flow after it's created.

1. On the Power Automate main page, select Solutions in the left


pane. Select your solution.
2. In the solution, select Processes, then select your process to edit
it.

Keep the following points in mind when you edit the stages of a business
process flow:

 Business process flows can have up to 30 stages.

 You can add or change the following properties of a stage:

o Name: You can change the stage name after you create
the stage.

o Table: You can change the table for any stage except the
first one.

o Stage Category: Remember, a category lets you group


stages by the type of action. It's useful for reports that
will group records by the stage that they're in. The
options for the stage category come from the Stage
Category global choice set. You can add more choices to
this global choice set and change the labels of existing
choices. You can also delete choices, but we recommend
that you keep the existing choices. If you delete a choice,
you can't add it back later. If you don't want a choice to
be used, change the label to Don't use.

o Relationship: Enter a relationship when the preceding


stage in the process is based on a different table than the
current stage. For the current stage, choose Select
relationships, and then specify the relationship that
should be used when the flow moves between the two
stages. We recommend that you specify relationships
because they provide the following benefits:

o Attribute maps are often defined for


relationships. These attribute maps automatically
carry over data between records. Therefore, they
help minimize the amount of data entry required.

o When you select Next Stage on the process bar


for a record, any records that use the relationship
are listed in the process flow. Therefore, the
reuse of records in the process is promoted. In
addition, you can use workflows to automate the
creation of records. Users then just have to select
the workflow instead of creating a record.
Therefore, the process is streamlined.

o Set Order Process Flow: If you have more than one


business process flow for a table, you must specify which
process is automatically assigned to new records. On the
action bar, select Order Process Flow. For new records
or records that don't already have a process flow
associated with them, the first business process flow to
which a user has access is used.

o Enable Security Roles: A user's access to a business


process flow depends on the privileges defined for the
business process flow in the security role assigned to the
user. By default, only the System Administrator and
System Customizer security roles can view a new
business process flow.

Now that you learned how to add a business process flow to your solution,
let's explore using them to guide your business processes.

Simulation - Create a Business


Process Flow That Has Conditions
Completed100 XP

 11 minutes

Business process flows guide you through the different stages of sales,
marketing, or service processes toward completion. For a simple process, a
linear business process flow is a good option. But in more complex scenarios,
you can use an enhanced business process flow that branches into different
directions, depending on conditions within the flow.

You can try the simulation first and then view the detailed steps once you
complete the simulation.

Note

Select the thumbnail image to start the lab simulation. When you're done, be
sure to return to this page so you can continue learning.
.

Branches are automatically selected in real time, based on rules that are
defined in the process definition.

 If you have Create permissions on business process flows, you


can use If-Else logic to create business process flows that have
multiple branches.

 The branching condition can be formed from multiple logical


expressions that use a combination of AND or OR operators.

For example, for the process of selling cars, you can set up a single business
process flow that starts with a common qualification stage but then splits
into separate branches, based on a rule:

 One branch manages the case of a customer who prefers a new


car or a pre-owned car.

 Another branch manages the case of a customer whose budget is


above or below $20,000.

 A third branch might be for purchasing or declining a maintenance


or service plan.

The following diagram shows a business process flow that has branches.
Guidelines for business process flows that have branches

Keep the following points in mind when you design a business process flow
that has branches:

 A process can span a maximum of five unique Dataverse tables.

 You can use a maximum of 30 stages per process and a maximum


of 30 steps per stage.

 Each branch can be no more than five levels deep.

 Branching rules must be based on the steps in the stage that


immediately precedes them.

 You can combine multiple conditions in a rule by using


the AND operator or the OR operator, but not both.

 When you define a process flow, you can optionally select a table
relationship. This table relationship must be a one-to-many (1:N)
relationship.

 More than one active process can run concurrently on the same
data record.
 When branches are merged, either all the peer branches must be
merged to a single stage, or each peer branch must end the
process. A peer branch can't merge with other branches and end
the process at the same time.

Note
 A table that's used in the process can be revisited multiple times. (That
is, there can be multiple closed table loops.)
 A process can go back to the previous stage, regardless of the table
type. For example, if the active stage is Deliver Quote on a quote
record, process users can move the active stage back to
the Propose stage on an opportunity record.

Prerequisites

 Access to Power Automate.

 An environment with a Microsoft Dataverse database and


Dynamics 365 Apps enabled. (Applicable only for work or school
accounts). If you don't have the Dynamics 365 Apps enabled you
can create a "Lead" table, but you need to add the appropriate
columns to follow along with the example.

 Experience with creating a business process flow.

Dynamics 365 customer engagement example: Car selling process flow


that has two branches

Let's look at an example of a business process flow that has two branches. In
this example, the business process flow is used for sales of new and pre-
owned cars.

First, we create a process named Car Sales Process.

1. Launch Power Automate and sign in using your organizational


account.

2. In the left pane, select Solutions.

3. Choose a solution where you would like to build the business


process flow.

4. On the top bar, select + New and hover over Automation, then
hover over Process, then select Business Process flow.
5. In the Build a business process flow pane, fill in the required
fields:

 Flow name: Enter Car sales process.

 Name: A unique name based on the display name that


you entered. You can change the name when you
create the process, but you can't change it after the
process is created.

 Choose a table: Select the Lead table.

The table that you select affects the fields that are
available for steps that can be added to the first stage
of the process flow. If you can't find the Contact table,
make sure that the Business process flows (fields
will be created) option is set for that table in the table
definition. You can't change the table after you save
the process.

6. Select Create.

7. Once the new page spins up in PowerApps, select the first stage to
the process, name the stage Qualify, and add two data steps to
it: Purchase Time frame and Car Preference.

8. After the Qualify stage, split the process into two separate
branches by adding a Condition component:

a. Set up the condition with rules that meet your business


requirements.

b. To add the first branch, which is run when the condition is


satisfied, add a Stage component to the Yes path of
the Condition component.

c. To add the second branch, which is run when condition


isn't satisfied, add a Stage component to the No path of
the Condition component.

Tip
To create more complex branching, you can add another
a Condition component to the No path of an
existing Condition component.

If Car preference = New, the process branches out to


the New Car Sales stage, as shown here.

Otherwise, the process goes to the Pre-Owned Car Sales stage


in the second branch, as shown here.

After all the steps in either the New Car Sales stage or the Pre-
Owned Car Sales stage are finished, the process returns to the
main flow, at the Deliver Quote stage.

Prevent information disclosure example

There are a few things that you need to consider to prevent people from
seeing specific information about a process flow.

This section uses the example of a business process flow that has branches
for processing a loan request at a bank. In the following diagram, the custom
entities that are used in the stages are shown in parentheses.

In this scenario, the bank loan officer needs access to the Request record,
but they shouldn't have any visibility into the investigation of the request. At
first glance, it looks as though we can easily meet this requirement by
assigning the loan officer a security role that doesn't grant access to the
Investigation table. But let's look at the example in more detail to see
whether things are really that easy.

Let's say that a customer submits a loan request for more than $60,000 to
the bank. Here's a high-level view of the stages and branches:

 In the first stage, the loan officer reviews the request.

 A branching rule checks whether the amount that's owed to the


bank exceeds $50,000. If this branching rule is satisfied, the next
stage in the process is to investigate whether the request is
fraudulent.

 If it determines that the request is fraudulent, the process moves


on to taking legal action against the requestor.

 The loan officer shouldn't have visibility into the two investigative
stages because they don't have access to the Investigation table.

 But if the loan officer opens the Request record, they can see the
entire end-to-end process. Not only can they see the Fraud
Investigation stage, but they can also identify the outcome of the
investigation because they can see the Legal Action stage in the
process.

 The loan officer can preview the steps in the investigative stages
by choosing the stage. Although they can't see the data or the
step completion status, they can identify the potential actions that
were taken against the requestor during the Fraud Investigation
and Legal Action stages.

In this process flow, the loan officer can see the Fraud Investigation and
Legal Action stages, and this ability constitutes improper information
disclosure.

Pay special attention to the information that might become disclosed


because of branching. In our example, to prevent information disclosure,
split the process into two separate processes: one for the request processing
and one for the fraud investigation. The process for the loan officer looks like
this.
The process for the investigation is self-contained and includes the following
stages.

You have to provide a workflow to synchronize the Approve/Deny decision


from the Investigation record to the Request record.

You might also like