Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Suggested answer

Can't solve invalid expression - Condition

(1) ShareShare
ReportReport
Posted on by 18
Hi
 
I have a SharePoint library (document set using content types) with start and end dates (in date format), plus a calculated column which is 60 days before the end date (also in date format). I have a status column (Choice) which I want to change to Good, Expiring, or Expired depending on today's date. Here is a snip of my columns from the SharePoint library:
 
 
I have created a flow in the past which I'm trying to recreate with this new list. I will run this flow in the small hours each day. I have an invalid expression error on my Conditions.
 
Flow structure:
 
Error and Condition parameters:
 
A possible hiccup could be that not all End Dates are populated, but in that case I would expect the flow to work but return errors.
 
I'm not sure how to structure a filter before the first condition.
 
Can anyone help me resolve the issue(s)?
 
  • Graeme_NZ Profile Picture
    18 on at
    Can't solve invalid expression - Condition
    Hi FLMike
     
    I'm new and trying hard.
     
    You say: "You don't mention anything about needing to read files, to make a chance (change?) to the row. So you are not explaining everything and its wasting time."

    I wrote this as my 2nd sentence in my original post. "I have a status column (Choice) which I want to change to Good, Expiring, or Expired depending on today's date."

    I am using 'Get file properties' because I am wanting to edit metadata from a SharePoint library (1st sentence in original post), and I want to sequentially do the same edit process for every file in the library. I had done this previously at my last workplace and it worked fine, and I'm struggling to understand why it isn't working for me. I have screenshots of my previous flow which I'm trying to replicate.
     
    Your answer has a lot of knowledge which may be clear to someone with experience, but which isn't obvious to me.

    I believe, if I understand you correctly, that I am attempting to do your Option 1 - "Create an Apply to Each (aka For each) and have it loop through the Array of values form the Dynamic value property from your Get Files, thats exactly where i got my photo from, my Get Files and a loop"
     
    When I'm in the interface, I can't select value - the only thing I can see is body/value
    However, it seems to return the same outputs as your picture.
     
    You wrote: "Well item() isn't in Scope, because you didn't LOOP through the data from Get Files, you can only use item in Loops or in Filter actions etc" The snip I posted in reply to this point was to clarify if this is what you meant to 'loop through the data from Get File', because I found that wording hard for me to understand.
     
    I think I followed your fix exactly, but it didn't work, I still have the same error, so I'm not going to mark the answer as solved. Instead I asked a clarifying question and felt that I got told off - but I don't understand what I've done to deserve that...

     

     
     
     
  • Michael E. Gernaey Profile Picture
    44,142 Super User 2025 Season 1 on at
    Can't solve invalid expression - Condition
    Hi
     
    I want to make sure you understand, not just change it and I have no idea why you are using Get Files. You don't mention anything about needing to read files, to make a chance to the row. So you are not explaining everything and its wasting time.
     
    You only have 2 choices, of how to access the data you want.
     
    You did the Get Files, it returns an Array, you either have to loop it, or use the straight syntax, assuming it only returns 1 File.
     
    So it doesn't matter what happened, before you have to do it one of the 2 ways I suggested.
     
    So the question is, is there 1 or more files you expect to do something with?

    I explained how to solve what your question is, anything beyond that is a totally different question/issue.

    I can't do anymore than I did, so mark it as the answer, don't but I answered you the fact you don't have or understand fully I can't really explain it any more than I have.
  • Graeme_NZ Profile Picture
    18 on at
    Can't solve invalid expression - Condition
    Hi FLMike
     
    You mean like this? I had tried this earlier and got stuck on something else...


     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    44,142 Super User 2025 Season 1 on at
    Can't solve invalid expression - Condition
    Ok I can see it
     
    Here is your problem
     
    You do a Get Files (properties only) but then you immediately create your condition and try to use item()
     
    Well item() isn't in Scope, because you didn't LOOP through the data from Get Files, you can only use item in Loops or in Filter actions etc
     
    So any time you do something that returns a bunch of records (or might) it looks like this
    check out the words
     
     
    outputs('Get_files_(properties_only)')?['body/value']
     
     
    So you have 2 options
     
    1. Create an Apply to Each (aka For each) and have it loop through the Array of values form the Dynamic value property from your Get Files, thats exactly where i got my photo from, my Get Files and a loop
     
    2. OR you can do this (IF you know there is only 1 row)
     
    in your condition left
     
    outputs('Get_files_(properties_only)')?['body/value']?[0]?['TPM Alert']
     
    // now my path just above me, requires you to know the exact path to the TPM Alert property so it could be like
    outputs('Get_files_(properties_only)')?['body/value']?[0]?['SomeOtherTHing']?['TPM Alert']
     
    But thats your issue
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    44,142 Super User 2025 Season 1 on at
    Can't solve invalid expression - Condition
    Hi
     
    I cannot see any picture if you pasted one in. It looks like you probably did but I cannot see it for some reason. Can you try again, or attach it also
  • Graeme_NZ Profile Picture
    18 on at
    Can't solve invalid expression - Condition
    Thanks for your reply, but I still get the same error. I added this like you said, and no change....

     
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    44,142 Super User 2025 Season 1 on at
    Can't solve invalid expression - Condition
    hi
     
    The issue is in the left you TYPED in item()?['TPM Alert']
     
    You needed to add the Expression item() NOT type it
     
    Go back clear it.
    CLick inside
    Popup window appears go to the Expression Tab
    type item()?['TPM Alert']
     click ok

    youll see the pink box like your UTC box

    You'll be right as rain
     
     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1