
Announcements
I have a complex SharePoint document approval online flow that I am going to have to implement in many different sites.
Copying and pasting it to each site is unmanageable in terms of cost and maintenance. For a start, the SharePoint trigger "For a selected file" and the "Get file properties" action are very specific to ONE site and ONE library.
The right way to do this is with a solution within which you include:
I've seen something very similar to what I'm aiming for in this great DamoBird video.
But there you manage lists and not libraries. And it doesn't work with libraries.
To start with, I need to obtain and transfer from parent to child flow two very specific things: the URL of the site and the reference of the library (with a GUID like a list?).
For the first I have used many combinations of expressions. So, if the site address is something like "https://fcces.sharepoint.com/sites/HUB", I've tried:
first(split(split(body('Get_file_metadata')?['{Link}'],concat('/',body('Get_file_metadata')?['{FullPath}'])))))
Which output is:
https://fcces.sharepoint.com/sites/HUB/Shared%20Documents/20230907%20prueba%20def/Doc%20de%20prueba_validado.pdf
first(split(split(body('Get_file_metadata')?['{Link}'],concat('/',body('Get_file_metadata')?['{Path}']))))))
Which output is:
https://fcces.sharepoint.com/sites/HUB/Shared%20Documents/20230907%20prueba%20def/Doc%20de%20prueba_validado.pdf
first(split(split(body('Get_file_metadata')?['{Link}'],concat('/',encodeUriComponent(body('Get_file_metadata')?['{Path}']))))
Which output is:
https://fcces.sharepoint.com/sites/HUB/Shared%20Documents/20231018%20Pruebas/Documento%20prueba%201.pdfThe truth is that I haven't been able to do something as simple as getting the URL of the parent flow and passing it to the child.
And I haven't yet been able to try to get some unique identifier of the library the file is in to pass it to the child as well.
Anyone out there who is working with parent-child flows at the library and file level (and not in lists)?
Many thanks in advance
Thanks to @DamoBird365 I have now been able to get the URL of the site from which the parent flow is launched. It's as simple as...
@DamoBird365 has also helped me doing some research on how to pass the file reference. But I still need to somehow pass the reference to the library itself. Because in my large child flow I use, among others, the SharePoint action Update file properties. And there, yes or yes, you have to indicate the library.
In addition, thanks to @cloudfronts and his video Single On-demand Power Automate Approval Flow for all SharePoint Document Libraries I have learned that library reference is more complex and ambiguous than that of the lists.
He achieves a kind of solution, but I aim for the parent flow to be very, very simple and light. And this one is not.
Another approach would be using environment variables (site and libraries). But... You know... When you manage a bunch of sites and libraries... It does sound not clean nor efficient mantaining so many variables.
I am somewhat surprised because it seems to me that the question I raise is quite logical and potentially useful for many companies. But I have not yet found the solution. And any help would be welcome.