Today in the Flow User Group, a fellow user was having trouble developing a Flow which monitored a OneDrive for Business folder (and sub-folders) and triggered when a file with a certain word in the name was modified.
Microsoft makes this (mostly) easy with the OneDrive for Business connector, as it has a trigger built-in that looks for a file to be modified, and it will even watch sub-folders ('preview' version as of this date). I quickly did a mock-flow and sent it to the user, excited to help someone solve a problem.
I used the native "Criteria" function to watch for anything with their keyword, and added the action that they wanted on either side.
The user replied that this definitely set them on the right path, but it wasn't making it past the criteria. For some reason, the Flow would terminate apparently because it didn't feel like the filename contained the actual keyword.
I tried variations with the keyword in quotes, shifting the criteria to "contains" instead of "ends with" and finally resorted to looking for help.
I found some posts from last year where people were having the same issue, and when they looked at the data collected by Flow, they found that the "filename" was actually the filename ID...not the Display Name that shows in Explorer.
To verify, I checked the output of the trigger and saw what I actually needed was the "x-ms-filename" which some of the earlier posts had referenced, but their version of the Criteria was different than what I saw, and they could enter this advanced-mode-code-looking nonsense:
Eventually, I found a post where someone mentioned the metadata, and that's when I found there was an additional step I could use to get the Display Name from the metadata, and then filter my trigger off of that.
I tested after adding this step, and the Flow behaved perfectly. Fun stuff!
I know there are probably more elegant ways to do this, but my favorite part of Flow is that I can accomplish things using the tools I know how to use.
Comments