Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

indexOf Error

Getting an Error on several Flows that have been working for Months with no challenges, Microsoft has produced the same error on their end. Any suggestions if this is not the best way to achieve the URL to update an item as the approval process progresses?


Initialize Variable

Name: Site URL

Type: String



substring(body('Get_file_properties_trigger')?['{Link}'], 0,indexOf(body('Get_file_properties_trigger')?['{Link}'], replace(body('Get_file_properties_trigger')?['{Path}'],' ''%20')))


Flow Error.jpg

Super User
Super User

Hello @SVC_SP_Workflow ,

based on the error message I'd say that the substring "replace(body('Get_file_properties_trigger')?['{Path}'],' ', '%20'" is not found in the "body('Get_file_properties_trigger')?['{Link}']", so it return -1 instead of a positive number = it ends with error message that the number must be non-negative.

[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Interesting, Flow worked fine up until Monday and works on other Triggers without an issue. I may do some additional Tests.

Have you solved it?

Helpful resources

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.


Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Users online (3,198)