Having watched and learnt the simple approval float from Jon Levesque & Ashley Rogers, which is great. I am happy the approval piece of my workflow runs fine. BUT, the problem is trying to rename the file based on folder.
My folders under Product & Solution Info library, the setup of folders are as follows:
/ProductA/00_ForApproval
/ProductA/99_Published
/ProductB/00_ForApproval
/ProductB/99_Published
........
/ProductG/00_ForApproval
/ProductG/99_Published
So the initial condition watches for any file posted to "/ProductX/00_" folder where "X" can be any Product folder - A,B,C..... the resultant file moves to a fixed named folder and performs the approval process, but remains as the same filename.
What I would like to do:
If file comes in to /ProductB/00_ForApproval/ folder, the file should move to /ProductB/99_Published. If file is approved in the process, it gets marked as Approve.
File needs to be renamed from "ProductB-AAB.txt" to "ProductB-VN-AAB.txt"
Issues:
With the move file I cannot seem to figure out how to apply a similar condition to move the file to the corresponding 99_Published folder and then how to rename based on the incoming format of the file.
Appreciate the guidance.
Solved! Go to Solution.
Hi @DarrenPlant
There is no direct rename function available so you need to create the file and delete the original file. Please follow the below steps.
Above expression for the replace is as follows:
replace(outputs('Compose'),'00_ForApproval','99_Published')
#
Above Get File Properties > Id is triggerOutputs()?['body/ID']
Get File Content File > Identifier is outputs('Get_file_properties')?['body/{Identifier}']
Create File >"folderPath": "@outputs('TargetPath')",
Finally the Delete identifier is outputs('Get_file_properties')?['body/{Identifier}']
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog@DarrenPlant To rename, you will have to create a copy of the file in the target folder, then remove the original from the source folder.
Hi @DarrenPlant
There is no direct rename function available so you need to create the file and delete the original file. Please follow the below steps.
Above expression for the replace is as follows:
replace(outputs('Compose'),'00_ForApproval','99_Published')
#
Above Get File Properties > Id is triggerOutputs()?['body/ID']
Get File Content File > Identifier is outputs('Get_file_properties')?['body/{Identifier}']
Create File >"folderPath": "@outputs('TargetPath')",
Finally the Delete identifier is outputs('Get_file_properties')?['body/{Identifier}']
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blog@abm Thank you so much, I was struggling to get my head around compose expressions. Your detailed explanation was a massive help to me 😎. If it was take one file and move, then rename, I was close to that. But when you add in complexity of checking across mutliple directories, reading that directory to publish to an adjacent directory in that tree, that's when life came difficult, but you came to the rescue. Thanks for being part of this community!
Hi @DarrenPlant
Thanks for the confirmation and glad to hear that you resolved your issue. This is one of the best community and there are lots of knowledge around.
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogUser | Count |
---|---|
94 | |
40 | |
23 | |
20 | |
16 |
User | Count |
---|---|
130 | |
49 | |
46 | |
30 | |
25 |