Picture2

Purpose: reduce human in achieve file for audit.

Process: At final of approval complete flow, mail will send to robot mail then trigger from unread mail. Get url from mail body, open in browser and download attached file to designated local folder.

Set up requirement

Building Desktop flow:

1.Prepare variable

img

Reference video

1.Action name: Set Variable
Setting :
Variable name : DownloadFolder
Variable value : "\\Parent_Folder\Sub_Folder"
2.Action name: Set Variable
Setting :
Variable name : GetMailFolder
Variable value : "\\Parent_Folder\Sub_Folder"

2.Outlook scope

1. Action name : Launch Outlook (Get **OutlookInstance**) .
2. Action name : Retrieve email message from outlook .(Get **RetrievedEmails**) .
Setting :
Outlook instance : %**OutlookInstance**% (from action 1).
Account : Your Mail account which connect with outlook.
Mail Folder : %GetMailFolder% (refer to variable which we create).
Retrieve : Unread email messages only.
Mark as read : Toggle-On

img2

Reference Video

3. Action name : For each %CurrentItem% from %RetrievedEmails%.
3.1 Action : Set variable
Setting :
Variable name : body
Variable value : %CurrentItem.Body%
3.2 Action : Parse text (Get **FoundURL**)
Setting :
Text to parse: %body%
Text to find: https:\/\/namedummy\.domain\.com\/document_link\/[^\s"]+
Is regular expression : toggle=On
first occurrence only : toggle=On

3.Download file from browser

in case company hide a href url for file download. img For case file link cannot get url directly, retrieve file will preform on click link to trigger download to local folder 'downloads'.

1. Action name : Launch new microsoft edge (Get instance name **browser**). retrieve %FoundURL%
2. Action name : wait for 2 seconds.
3. Action name : Extract data from web page %**browser**%. (Get **Extract_Dt**)
4. Action name : Retrieve data table column (Get **Extract_Dt**) in to list (Get **FilesName**).

filename

5. Action name : For each %CurrentItem% from %FilesName%.
5.1 Action : Run Javascript (Get %Trimmed text%)
var links = document.querySelectorAll('a');
var found = false;
for(var i = 0; i < links.length; i++){
if(links[i].textContent.trim() === '%CurrentItem%'){
found = true;
break;
}
}
return found;
5.2 Action : Get details of element on web page

img2

Reference video

5.3 Action : Click link on web page (select ui element, flow will pick up each file name from lists and click link to load file one by one.

img3

Reference video start at 3:04

4.Move file and folder

Add process inside for each loop

1. Action name : If file exist **condition ** indicate value as 'folder download\' %Trimmed text%)
Inside if loop
2. Action name : Get files in folder 'download\' that match %Trimmed text% and store them into %Files%
3. Action name : Move file(s) from 'folder download\' %Trimmed text% to folder %DownloadFolder%
End if loop

5.Connect with cloud flow.

1.Save and publish desktop flow.
2. Open Cloud flow
3. Select recurrence on daily basis with fixed time.
4. Select action name : Run a flow built with Power Automate for desktop
Setting:
Desktop flow: select publish desktop flow name to implement.
Run mode : attended (runs when you're signed in)


❤︎ · ⸜(。˃ ᵕ ˂ )⸝♡ · (˶ᵔ ᵕ ᵔ˶) · ⋆.𐙚 ̊ · ദ്ദി(˵ ̀ ᴗ - ˵ ) ✧ · ꉂ(˵˃ ᗜ ˂˵) · (˶˃𐃷˂˶) · ❤︎

We use this case as practice for outlook and web scrapping practice.

Total save time vs human tasks is not much when consider to actual business impact but in long term where we have similar tasks which can deploy this flow in less than 10 minute will benefits users and more organize with standard flow.
Marked date 17 Apr 26 , I have read "The Book of Elon: A Guide to Purpose and Success" by Eric Jorgenson, Naval Ravikant and wanted to share this quote with you.

"Not every product needs to change the world. Many people do lots of useful things. Just ask yourself, is what I’m doing as useful as it could be? The goal of an organization should be usefulness to society. Not every product will change the world, but if it’s making people’s lives better, that’s great."



❤︎ · ⸜(。˃ ᵕ ˂ )⸝♡ · (˶ᵔ ᵕ ᵔ˶) · ⋆.𐙚 ̊ · ദ്ദി(˵ ̀ ᴗ - ˵ ) ✧ · ꉂ(˵˃ ᗜ ˂˵) · (˶˃𐃷˂˶) · ❤︎