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

Power Automate Flow error: InvalidTemplate. The length of substring can't be longer than '45' which is the length of the source string.

I am getting the above error in a workflow I am creating and I cant seem to figure out how to reword the compose elements.


This is what I am trying to do:

I need the compose element I have highlighted to be any name not this one so that it looks for any sub folder names not just this one.  Every time I try to change elements to make it look for something else I get the error above and Compose 3 comes out at -1.


 Can anyone offer me any help with this ?

Super User
Super User



It looks like you are missing either a startIndex or length in the substring function of the compose 2 action (if the note is the same as the actual expression). I only see one number in the substring function.

Hi @Expiscornovus 


Thank you for your reply.  Yes the notes are the copied expressions as its easier for me to see them when checking.  I am using this on a test area at the moment but the length of the folders could be any length.  I am trying to get the workflow to create folders as needed for approvals to save on unnecessary storage of data.  So the scenario is we have a project folder ie Test Project 23 then the folders like QA to Check are created when the option is picked.  So the path becomes Test Project 23/QA to Check,  I need the compose to take the QA to check off when its Approved and create a new folder at the first level ie Test Project 23/Approved and then move the document into there for issue.  Does that make sense ? obviously the real names of the projects will be something else and can be any length rather than the 17 characters we have in currently


This is the output in the error 



Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (4,268)