Rename a File Upload

  • 17 November 2022
  • 3 replies
  • 43 views

Badge +3

I have a workflow that originates with a Cloud Form that includes a File Upload control. Later on in the workflow we store that file (or files) into a Google Drive folder. Is there a way to rename those files before storing them into Drive?


3 replies

Userlevel 3
Badge +9

I don't have experience with Google Drive access from NWC. But with SharePoint, if you store them e.g. in a temporary SharePoint document library using the Store A File action, you get a useful return object that tells you the item ID of the file just stored. The Update item action can then do the trick for you with a condition set on this ID. If nothing else helps you might use this as the in-between step. Hope this helps a bit.

Badge +3

So according to the documentation on Storing a Google Drive folder you can supposedly output a bunch of fields into a collection, one of which is the ID of the file. I've created a second Loop For Each action to try to extract that metadata from the outputted collection but it is blank. I must be missing something: https://help.nintex.com/en-us/nwc/Content/Designer/Actions/GoogleDrive-StoreaFile.htm

Badge +3

Ok, so if anyone else has this problem, here's what you do:


 


1. Store the file into Google Drive and output it into a collection


2. Use a "get item from collection" and pull index 0 from that collection and store it into a variable


3. Use Query JSON on that variable and use the query "$.id" - Store the result of the query into a new variable


4. Use "rename a file" and use the variable from step 3 as the file ID to rename it


5. Make sure there is no other file in that folder with the same name as the file you are trying to rename. For some reason it throws an error even though the action completes.

Reply