Flow / Power Automate - Add Conditional “Switch” Actions in Power Automate Tutorial

Learn how to create conditional 'switch' actions in Power Automate to generate sequences of actions based on specific cases. Avoid the nesting of multiple if conditional blocks and efficiently sort files into different folders based on their extension. Configure automated flows, isolate file extensions using Power FX language, and define specific actions for each case. Test and verify the functionality to ensure a seamless workflow. Explore this fully functional switch condition usage example now!

  • 03:58
  • 25 views
00:00:07
which allows you to generate sequences of actions based on specific cases.
00:00:11
Thus avoiding the nesting of multiple if conditional blocks
00:00:16
to illustrate this.
00:00:17
Let's take the example of a file deposited in a team's team folder
00:00:21
which depending on its extension will need to be sorted into different folders,
00:00:25
word Excel, powerpoint, as well as in others folder
00:00:30
begin by configuring this automated flow using a SharePoint
00:00:34
trigger based on the creation of a file.
00:00:42
Select the target team as well as the relevant library.
00:00:47
In this specific case,
00:00:49
limit the monitoring to a specific folder by checking
00:00:52
the restrict to folder option in the advanced settings.
00:00:55
Then specify the concerned folder. In this example, file sorting
00:01:01
to test the file extension include a function
00:01:03
in power FX language that isolates this extension.
00:01:07
Another tutorial covers the basics of power FX in more detail.
00:01:11
But here look for the message action in the predefined actions.
00:01:14
Then in the data operation category,
00:01:17
use the FX button to paste the isolation function.
00:01:23
The next step is to retrieve the file's metadata,
00:01:26
particularly the access path which will be used in the process of moving the file.
00:01:32
Once the team's team containing the monitored folder is specified
00:01:35
point to the deposited file to retrieve the metadata.
00:01:38
To do this, add the dynamic content,
00:01:40
identifying the file using the identifier field associated with the file.
00:01:46
You can now generate your actions according to the file type by adding
00:01:50
an action from the control category and choosing the conditional switch action.
00:01:54
It is from the isolated file extension that you can process all specific cases.
00:02:00
Test the element to be evaluated,
00:02:01
which is the output of your message containing the file extension.
00:02:05
Then add a specific case for powerpoint files, PTX
00:02:11
and a SharePoint file move action
00:02:16
specifying the site or team's team address,
00:02:19
reference the file by its path dynamically
00:02:22
retrieved from the get file metadata action
00:02:24
specify the destination
00:02:27
here a sub folder named powerpoint.
00:02:30
In the same library,
00:02:31
you can also define the default action in case of a file
00:02:34
with the same name and set a move with a new name.
00:02:38
Repeat this procedure for each type of extension
00:02:41
XL X for Excel and doc X for word rename your
00:02:45
cases for clarity by changing the labels for each case,
00:02:48
add the file move action in the
00:02:50
same manner indicating the appropriate target folder
00:02:53
for the default case,
00:02:54
define the actions if the file extension does not match
00:02:58
any of the previously processed cases using for example,
00:03:01
in others folder,
00:03:03
finally add a team's message posting action after the conditional block,
00:03:07
which will execute regardless of the processed case
00:03:15
specify that a file has been added to a specific folder using the dynamic contents
00:03:27
save and test your flow.
00:03:30
Upload a file from teams, for example,
00:03:33
a powerpoint presentation and verify that the
00:03:35
file is properly moved to the right place
00:03:40
and that the team's message is correctly posted,
00:03:44
repeat with a PDF file to ensure your flow works perfectly. For all cases.
00:03:52
There, you have an example of a fully functional switch condition usage.

No elements match your search in this video....
Do another search or back to content !

 

DiLeaP AI: THIS MIGHT BE HELPFUL

Reminder

Show