web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Equals Expression Not ...
Power Automate
Unanswered

Equals Expression Not Right

(0) ShareShare
ReportReport
Posted on by 76

Hello,

 

I have a flow that checks if a file has been through the approval process or not (a different flow) by looking at its name and by comparing it to a value in a sharepoint list that's generated from the other flow mentioned and if it has  been move it to its appropriate folder based on response from an email. I have two questions with this flow at the moment, one I've been actively trying to fix and the other I haven't spent as much time on.

 

1. Equals Expression

I have a condition (shown below) that I would like to check the name of the file thats being checked (the when a file is created (properties only) trigger) contains the '.Approved', which is what I have in the condition at the moment so that way it works when I test the flow since the other part isn't working. Along with this, I want the condition to check that the Approved column in the Sharepoint List for that item has the value yes (true when it's imported into the flow). This is where I'm struggling.

 

equals(body('Get_items')?['Approved'],'true')

This is the equation I'm using at the moment but every time I run it, it returns false. It should return true but its not and I'm not sure what I'm doing wrong. I'm writing the word true exactly how it gets outputted from the Get Items action as shown below. Any thoughts?

 

 

In the end, I'd like to do an and expression to combine them together but until I get this part, I can't.

 

2. When I'm moving the file into its new folder, a subfolder of the one its in, it loses it's content even though the file content is being used. I've also noticed that it loses its type (ex. excel). Is there a way around this? I know subfolders isn't fully supported on Flow yet but is possible.

Overall FlowOverall FlowGet Items Body OutputGet Items Body OutputConditionConditionFile in Main FolderFile in Main Folder 

File in SubfolderFile in Subfolder

 

 

 

 

 

 

 

 

 

 

 

 

Thanks,

leanns

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @leanns,

     

    Could you please share a bit more about the Approved column within your SharePoint List? Is it a Yes/No type column?

     

    I suppose that the Approved column within your SP list is a Yes/No type column, is it true?

     

    If the Approved column is a Yes/No type column in within your SP list, I think there is something wrong with the Equals Expression that you provided. Please take a try to modify your Equals Expression as below to check if the issue is solved:

    equals(body('Get_items')?['Approved'],true)

    Note: The true is a Boolean value rather than a string. The true is not wrapped with single quotes.

     

    For your second question, could you please share a bit more about the replace() expression within the File Name field of the "Create file" action?

     

    I think there is something wrong with the formula that you provided within the File Name field of the "Create file" action. Please check if the result the replace() expression returned contains the file name extension, if not, please append the file name extension into the replace() expression.  Please check and see if the following thread would help in your scenario:

    https://powerusers.microsoft.com/t5/Building-Flows/Renaming-files-using-a-Flow/m-p/120101/highlight/true#M11643

     

     

    More detais about creating a file within a new created subfolder folder, please check the following thread:

    https://powerusers.microsoft.com/t5/Building-Flows/create-new-folder/m-p/117084/highlight/true#M11345

     

     

    Best regards,

    Kris

  • leanns Profile Picture
    76 on at

    @v-xida-msft

     

    Thank you for the suggestions. They fixed my problems mentioned above. I appreciate the help. I did have to do a work around since I couldn't pull the Approved token from the Get Items actions by using some compose statements and a variable. But the equation works, I just had to grab the token in a different way.

     

    I have marked your reply as my solution.

     

    Thank you again,

    leanns

  • leanns Profile Picture
    76 on at

    @v-xida-msft,

     

    Hello, as I am trying to combine my equals expression and Name check expression together I keep getting an error. I was wondering if you could take a look and see what little thing I'm missing because they work separately but not together.

     

    contains(triggerBody()?['Name'],'__Approved')

    *the __ is a double underscore

     

    equals(outputs('Compose_2'),true)

     I've tried combining them with the and expression and the if expression but I keep getting this error:

    contains_error.PNG

     

     

     

     

    Here's a picture of the flow that I'm trying to fix:

                             expressions.PNG

     

     

     

     

     

     

     

     

     

     

    Thanks again,

    leanns

  • leanns Profile Picture
    76 on at

    Nevermind I figured it out. I just needed to retype in the expressions. The syntax wasn't correct for the triggerBody() expression.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard