Skip to main content

I would like to upload a file to SPO through Nintex Automation Cloud and then get the ID of the new record created for use in updating the other fields on a form.

 

How would I do that?

 

 

You can use the SharePoint Online - Store a file action with the Output variable set to a workflow variable. This will store the file in your library of choice and load the file details in that variable which will be available to other actions in your workflow.

https://help.nintex.com/en-US/nwc/Content/Designer/Actions/SharePointOnline-StoreaFile.htm

 

In this example I grab a file that comes in from the File Upload control on a form. Store it in a library with the SharePoint Online - Store a file action and have the action populate an output variable with details that show where that file is. That variable is an object style variable that stores those details.

 

Then later, I want to do something with that file in a workflow as it sits in SharePoint, so I use the SharePoint Online - Get a file action with the URL option stored in that output variable to retrieve the file.

 


Right now, I tried to use this control, but I don’t know if it’s working, and if it is, where the files are being uploaded too. They don’t show up in the SPO document library. There is also no output variable on this control for me to select. What am I doing incorrectly?

 


So basically, the workflow is what will store the document to SharePoint after the file is uploaded by the user and the form is submitted. When the form is submitted, the workflow instance is started and the Store a file action for SharePoint Online will put files in a document library. The example below will walk through how to store one file, however, if multiple files are uploaded in a form submission, then the workflow would need to loop through that collection of files using the Loop for each action and store them one at a time in the library.

 

Storing One File:

Add the file upload control to a start form. This allows you to upload a number of files based on the Maximum files upload allowance property in the configuration. These files will come in through the start event as a collection variable tied to the upload control. Here is an upload control named, “My File upload” on a start form that allows up to 10 files to be uploaded.

 

 

After the form is submitted, the workflow will need to parse through the Start Event’s File Upload collection variable and run the SharePoint Online - Store a file action to save each file to a SharePoint library. In this image I have the Collection operations – Get item from collection action pull the file at index “0”(collections are zero based) from the collection and store it in an output File variable called “Uploaded File”. This makes the physical file available to the workflow. Again, only worrying about a single file stored in index position “0” of the collection for this example. 

 

Next drag the SharePoint Online – Store a file action to the canvas and configure it to use the output file variable from the previous action. Point to your desired document library based on the SharePoint Online connection.

 

 

To store the URL and other details about this file as it’s stored in SharePoint you can configure the output variable for this action. In this example an output variable called “Stored file in SharePoint” is created for later use. This is an Object style variable.

 

 

You can then access the details like a File URL link in actions like Send an Email by using the SharePoint Online -> Stored File in SharePoint -> File URL. You can also access the Item ID column if desired for querying SharePoint.

 

 


Thank you. This is awesome. I followed your example exactly and it worked!


Reply