How to update metadata of uploaded documents in List or Library control

Sometimes, when working with List or Library control, you might want to automatically populate certain values for newly uploaded documents.

If you’ve selected Lookup field in Data Source, this field is populated automatically by default:

Data Source configuration

Other fields are not, and you might want to specify certain properties for the uploaded documents, for example, take some data from the current form or make some additional requests with JS. In this article, I will show you how this can be achieved.


For Document Library, you can detect when files are uploaded, retrieve their IDs and use them to modify the documents right after they were uploaded.

Simply use the following code:

var listOrLibrary = 'SPDataTable0';
var docLibraryTitle = 'Documents';

fd.spRendered(function() {
        function(itemIds) {
            //get document library by Title
            var library = pnp.sp.web.lists.getByTitle(docLibraryTitle);
            //go through each uploaded Item Id and set field values

                var batch = pnp.sp.web.createBatch();

                for(var i = 0; i < itemIds.length; i++){
                    //specify which fields to update and how
                        Title: fd.field('Title').value
                    }, "*", entityTypeFullName);


And here is the result:

Plumsail Forms - Form is submitted trigger

For more information, check out pnpjs documentation on working with SharePoint items.