Is there a way I can do this for a selected file? So each time a file is selected it will convert to PDF - the action looks like I need to select the exact file I want to convert when using SharePoint Online - if I do not know what file I want to convert or if this is variable can I incorporate that into the Flow?
You can remove that 'Get file metadata' ...you shouldn't need that.
For your 'Convert file' your 'File' should be "Id" selected from the dynamic conent of your 'Create file' (OneDrive)
and then for the 'Create file' (SharePoint) the file name and file content should be selected from the 'Convert file' of your dynamic content.
It should work fine.
This worked perfectly for me - much better than the template from MS Flow, which works the first time and then failed everytime on the convert part.
The only problem I have now is that I want to attach the file to another list and it doesn't work, even though I'm giving it the ID for the list and also update the list item with other data). it says that the record cannot be found....
Yes I am but the difference with my flow and your flow is that I want to attach the file to a different list - but I do have the right ID for the target list! Do I need to do get item again from the list where I want to put the attachment?
I think you will need to do a 'Get Item' in there before the 'Add Attachment' portion unless you are already using that in another spot in your Flow...you don't need it twice.
How are you getting the 'ID' that you said you already have...where is it coming from?
I sometimes carry through the ID from PowerApps into Flow and then I use Compose to set it as a variable in my Flow. I have used that before on my 'Get Item' so I can use it instead of the 'Get Items'..I have not tried it with the 'Add attachment' but in theory it should work the same.
I carry the ID through to the subequest list (basically, the first list is where the user makes the request and the second list deals with approvals and other processes before completing). The attach file process doesn't seem to like the ID but it works fine when I update the initial request with other stuff.
The other problem that I just noticed is that when I create the Word document without first creating a file in a sharepoint library, the date fields are not accepted. So I think I need to create the word document from the library rather than from the list... I want to kill myself!
Also, keep in mind that ID is not a text field..it is a value so for example if you are storing the ID from one list in a column on another list that is set to a singleline text you have then made it a text field. To refer back it in Flow you will have to use Compose to convert it back to a value.
On most of mine I carry the ID directly from PowerApps into Flow so it is still the correct format so I don't have to do that often...but I did run into that issue once. I use the int() to convert it back to a number or "value".
It's stored as a number and it works fine for updating the list, it's only when I try to add the attachment.
I'll keep playing about with it.
Thanks for you help, I really appreciate it 🙂
How are you updating the list without using 'Get item'?
You should need to do that compose and convert that ID and then you probably won't need the extra 'Get Item' in there.
Mine does two steps:
1) Compose - Select the field that stores the ID number from the Dynamic content
2) Compose - Expression - int(outputs('Compose1'))
So..step one is getting that ID and step 2 and converting it. Your 'ID' you will refer to on the Add Attachment will be the output of the second Compose.
I'm not sure about that second part what the issue could be...I use this a lot and never do anything with with SP Library for it...keep playing around with it.
Finally managed to get it work without going through onedrive. Wine is a wonderful help sometimes!
This seemed to do the trick.
I am using CDS connector to get data from flow and populating that in MS word template. I am saving this to onedrive. And then i am using this connector to convert created word document to PDF, the pdf is generating but with the logical names not with the data from CRM.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
Check out the community blog page where you can find valuable learning material from community and product team members!