First post to this forum. I am not a programmer, but I have been creating flows for months now - but am stuck on what I would assume is a slam dunk easy one, I simply want to copy a new or modified file from one Sharepoint folder to Another if the filename begins with a certain string. These are PDF files that are named for an Order Number that begins with something like '703' (i.e. 7031234567.pdf).
Regardless of how I use the condition (Starts With, Contains, Equals) The flow runs successfully, but the results of the condition are False. I am using single quotes to ensure a 'string' comparison. I've also tried Contains / Equals and have tried these other normal filenames to avoid the numeric issue (i.e. just naming the file 'INVOICE' - with or without the extension), - but always returns False. What Am I missing?
Trigger = Sharepoint - When a file is created or modified in a folder
Condition - File Name starts with (contains, equals) - '703' ('7031234567' / INVOICE / INVOICE.pdf )
@startsWith(triggerOutputs()['headers']['x-ms-file-name-encoded'], '703') ... have used all combinations of single/double/no quotes.
Any help is appreciated
Solved! Go to Solution.
Hi @ FJanssen1,
Could you please share a screenshot of the configuration of your flow?
Why are you use the expression "triggerOutputs()['headers']['x-ms-file-name-encoded']" in the condition of your flow?
I have made a test on my side to use expression "triggerBody()?['{FilenameWithExtension}']" in the condition of my flow and don't have the issue that you mentioned.
I have create a flow as screenshot below:
The expression in the condition as below:
@startsWith(triggerBody()?['{FilenameWithExtension}'], '703')
When a file is created or modified in the library, the flow would run successfully as below:
Please check the expression in the condition of your flow, and take a try to use "triggerBody()?['{FilenameWithExtension}']" instead of "triggerOutputs()['headers']['x-ms-file-name-encoded']" in your flow to see if the issue still exists.
Regards,
Alice Zhang
Hi @ FJanssen1,
Could you please share a screenshot of the configuration of your flow?
Why are you use the expression "triggerOutputs()['headers']['x-ms-file-name-encoded']" in the condition of your flow?
I have made a test on my side to use expression "triggerBody()?['{FilenameWithExtension}']" in the condition of my flow and don't have the issue that you mentioned.
I have create a flow as screenshot below:
The expression in the condition as below:
@startsWith(triggerBody()?['{FilenameWithExtension}'], '703')
When a file is created or modified in the library, the flow would run successfully as below:
Please check the expression in the condition of your flow, and take a try to use "triggerBody()?['{FilenameWithExtension}']" instead of "triggerOutputs()['headers']['x-ms-file-name-encoded']" in your flow to see if the issue still exists.
Regards,
Alice Zhang
Thank you.
Changing from the SP Trigger: File Created or Modified to the one you showed, File Created of Modified Properties Only) and using your condition statement made the difference. I don't really understand the difference between the triggers (after reading the help) - but I'll chalk that up to my general ignorance... I am just glad it works - Thank You!
Hi Alice,
I have a similar problem as Fjanssen1 but when I try to use "triggerBody()?['{FilenameWithExtension}']" instead of "triggerOutputs()['headers']['x-ms-file-name-encoded']" I get an error on my flow when running that says:
"InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2529': 'The template language expression 'startsWith(triggerBody()['{FilenameWithExtension}'], '"Active Users"')' cannot be evaluated because property '{FilenameWithExtension}' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.
Do you have any idea on how to cope with this error?
Hello,
How do I get to see the Condition in that Advanced way so that I can enter "code" ?
THanks,
Mihnea