
First time poster - First time necessary. 🙄
Hoping the community can help after my many hours of searches have come up empty. I have a Power Automate sequence tied to a SharePoint list via the trigger “When a new item is created.” The SharePoint list is a Document Log that uses a SharePoint list derived PowerApps form to designate up to six levels of filing structured information (see Exhibit A).
The PowerApp follows the initial Tier 1 selection with a series of up to five cascading drop-down tiers. The user also must attach a file in the PowerApp form “Attachments” field that will be copied to the Document Repository (a SharePoint Document Library) to a specified file path (discussed below), and then deleted from the SharePoint list item (but adding a hyperlink to a hyperlink column in the list to the file location in the Document Repository so users can locate the document later by either searching the list or the Repository) (see Exhibit B).
The last list detail that might be relevant is that when the PowerApp new form is saved, the PowerApp writes the final tier selections back to the SharePoint Tier 1 through Tier 6 list columns, which are merely single lines of text (see Exhibit C).
EXHIBIT C
Once the Power Automate trigger occurs (i.e., saving the new item created via the SharePoint list PowerApp), a “Create new folder” action creates a folder (if not already created) in the Document Repository using Dynamic Content to define the Folder Path by using the six (or fewer) tiers selected by the user in the PowerApp / SharePoint list form (see Exhibit D).
EXHIBIT D
Following the “Create new folder” action, there are actions to “Get Attachments” and “Get attachment content” from the SharePoint list item generated through the PowerApp form, and a “Create file” action. The “Get attachment content” and “Create file” actions are embedded in an “Apply to each” loop that Power Automate automatically created, even though the PowerApp form restricts file attachment to a single file for each item saved to the Document Log SharePoint list (see Exhibit E).
EXHIBIT E
The “Create file” directs the location to create the file to the “Folder Path” that was generated in the “Create new folder” Folder Path using the Dynamic Content from the Trigger Action (“When a new item is created”). The PowerApp form writes the record to the SharePoint list (Document Log), which triggers the Power Automate activity flow. Using the example provided below in Exhibit F, this should save the file INSIDE the folder “Tier 6 – TEST 20191226 01”
EXHIBIT F
Instead, it saves the file in the folder that is one folder higher (which in this case is “Tier 5 – TEST 20191226 02”) (see Exhibits G and H).
EXHIBIT G
EXHIBIT H
I have worked around this issue in other Power Automate activities by simply duplicating the last folder tier in the file path, thereby leaving an empty final tier folder in the folder of the same name (e.g., Folder path: “Tier 1/Tier 2/Tier 3/Tier 4/ Tier 5/Tier 6/Tier 6”). That was sufficient when there is always a static number of filing tiers (i.e., in this example if there were always 6 tiers of categorization for every file). However, in my current scenario, it is rare that a file requires the full 6-tier level of categorization. Using the workaround described above would result in me having to nest six conditions to accomplish that workaround, which makes me think that in addition to being a clumsy expectation to have to build a dangling extra, duplicative folder tier for each categorization tier, there must be something I am missing in configuring the “Create a new folder” action.
Any ideas, community? Thanks in advance.
Chris.