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 / condition length(..) >...
Power Automate
Suggested Answer

condition length(..) > 0 invokes error on ground first statement is a string

(0) ShareShare
ReportReport
Posted on by 704
 
I had a flow emailing with attachments from a sharepoint document library that worked perfectly until I got some vague rights error
 
'Failed to refresh access token for service: sharepointonlinecertificatev2. ....etc (whole error under this message)
 
So I rebuild the flow and it works but for one strange error
 
The flow gets the filenames of the attachments as JSON text from powerapps.
After parsing the JSON I do apply to each: get files (properties only) to test if the attachment actually exists on sharepoint 
For this I made a condition
length(outputs('Get_files_(properties_only)')?['body/value']) > 0
 
If I enter the same code for the condition into the new flow the flow fails at running
Action 'Condition' failed: Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'greater' expects two parameter of matching types. The function was invoked with values of type 'String' and 'Integer' that do not match.'.
 
If I bypass the error by just stating
3 > 0 
as condition
The flow works as expected but only when the files actually exist on sharepoint 
 
Anyone any idea why code using length that used tot be an integer now suddenly is a string?
If anyone knows why I had this token error in the first place?
 
Action 'Get_files_(properties_only)' failed: Error from token exchange: Runtime call was blocked because connection has error status: Enabled| Error, and sharepointonline is in the block list. Connection errors: [ParameterName: token, Error: Code: Unauthorized, Message: 'Failed to refresh access token for service: sharepointonlinecertificatev2. Correlation Id=ba583154-fbb1-4ea8-bad6-c08e41c3973e, UTC TimeStamp=12/2/2024 9:50:52 AM, Error: Failed to acquire token from AAD: {"error":"invalid_grant","error_description":"AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2024-08-11T15:23:45.3627307Z and was inactive for 90.00:00:00. Trace ID: cda842e9-79e3-4991-a69d-05bfc1e1e800 Correlation ID: e4c735ca-9785-4bea-a235-d5938732da39 Timestamp: 2024-12-02 09:50:52Z","error_codes":[700082],"timestamp":"2024-12-02 09:50:52Z","trace_id":"cda842e9-79e3-4991-a69d-05bfc1e1e800","correlation_id":"e4c735ca-9785-4bea-a235-d5938732da39","error_uri":"https://login.windows.net/error?code=700082"}']
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    I don't think the problem is the length() function.  Based on the error message you posted I would double check with the Power Platform admins that they haven't set up a Data Policy to Block the use of the SharePoint connector in the environment where your flow is running.  This in the error message is what suggests the Data Policy has changed. "...and sharepointonline is in the block list."
     
    If the Get files (Properties only) fails because the SharePoint connector is blocked then the results won't be an empty array. It will be some kind of error message. And that will cause an issue with Length()
  • Suggested answer
    HansHeintz Profile Picture
    704 on at
    @Pstork1 Thanks for answering.
    To be clear: the block list error is on the previous error of my flow not on the new one.
     
    On the new one I can clearly see in the run history that the fault is in the condition step and like I stated: if Imake the condition step 3>0 (aka always true) the new flow runs perfectly.
    Meanwhile I found out what I forgot from making this flow half a year ago is that googling my way through this PA non coding bliss I found this
    where it states that you have to turn on pagination on the get file properties step.
    With this on al works perfectly again.
     
    Incredible through how many hoops you have to jump only to check if a file exists on sharepoint. 
    Still left wondering who or what blocked my original flow.
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    To clarify a bit. You can either turn on pagination or put in an appropriate number in the Top Count field of the Get Files action.  If you don't fill it in then Top Count defaults to 100.  So if the file you are looking for isn't in the first 100 it won't be found.  Increasing Top Count or turning on pagination will solve that issue. If you are searching less than 100 files it won't be a problem.
     
    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard