Hi Community,
I am facing an issue with an If Else condition in my Power Automate Desktop flow. Despite setting up the condition correctly, it doesn't seem to work as expected.
Context: I am working on a flow to read contract IDs from an Excel file, search for each contract from test environment and download associated documents. If documents are found, the status should be marked as "Success"; otherwise, it should be "No Document Found".
Here are the main steps in my flow:
Launch Excel and read contract IDs.
Loop through each contract ID.
Launch Chrome and navigate to specific webpage
Log in and search for the contract ID.
Check if a document download link is present using an If Else condition.
Update the Excel file with the status and timestamp.
Specific Issue: The If Else condition is supposed to check if a document download link exists. However,it doesn't seem to work as expected.
Here is the relevant part of my flow:// Extract Contract ID from CurrentRow
Set Variable
- Name: %CurrentContractID%
- Value: %CurrentRow["ContractID"]%
Launch new Chrome
- URL: [Webpage URL]
- Instance Variable: %BrowserInstance%
// Find the Document Link
Find Element on Web Page
- Instance: %BrowserInstance%
- Selector: [Selector for the document download link]
- Result Variable: %DocumentLink%
// Check if documents are available
If
- Condition: %DocumentLink% is not empty
- Then
Set Variable
- Name: %Status%
- Value: "Success"
// Perform the document download...
- Else
Set Variable
- Name: %Status%
- Value: "No Document Found"
End If
What I’ve Tried:
Ensured the selector for the document download link is correct by using the browser's inspect tool.
Verified the %DocumentLink% variable is being set properly.
Tried adding logging to see the values of variables at different stages
Error or Unexpected Behavior: Despite these checks, the If Else condition doesn't behave as expected. It either always goes to the "Else" part or doesn't evaluate the condition correctly.
Could someone please help me understand what might be going wrong with my If Else condition? Any insights or suggestions would be greatly appreciated.
Thanks in Advance
Usha