Is it possible to prompt for metadata on document upload?

A client has asked if it is possible to open the document’s edit form following a successful document upload.

Is this possible to do within the ‘filesUploaded’ handler in the fd.control(dataTable) function?

Thanks
Andy

Dear abolam,
It's possible to do, but there are some complications. You can use the following code, just replace the Internal Name of the List or Library control, your site URL and List ID for the Documents Library where you upload these files:

fd.spRendered(function(){
	fd.control('SPDataTable0').$on('filesUploaded',
    function(itemIds) {
        itemIds.forEach(function(itemId) {
            var listId = "a1d9f64b-400f-4773-8186-35520b878eea";
			var URL = "https://domain.sharepoint.com/sites/site/subite/_layouts/15/listform.aspx?PageType=6&ListId=" + listId  + "&ID=" + itemId;
			window.open(URL, "_blank", "width=400, height=400");
        });
    });
});

List ID can be found in the URL, if you open a form for the Documents Library, here it is:

Now, there is an issue with the code - some browsers will completely block the pop up with no message whatsover! IE and Edge do the job, although they give a warning that this might be potentially dangerous, but Chrome didn't give me any warning at all, so it took a bit of testing to figure out what was the cause. But sadly, not much can be done with this limitation for now, perhaps changing security settings in the browser might help.

Hi Nikita,

Yes I agree, Chrome ignores this completely and although it works in Edge and IE, it seems inconsistent with the ‘Edit’ button behaviour. Is there another way to approach this? Perhaps by triggering a button click on the associated edit icon once a document has uploaded?

Andy

Dear Andy,
Not sure that this would be possible, though we can look into it. Main issue is the fact that user can easily upload multiple documents, what happens when? It will be impossible to open multiple forms at once right now, and it doesn’t seem feasible to open them one after another, so I can’t say what would be the best solution in this case.

Hi Nikita, appreciate this is a tricky thing, especially where multiple docs are concerned. Of course opening multiple dialogs at once would be impractical, if not impossible.

If you can look into this I think it would be a good feature to have - even if the forms opened one after the other I think our client would be happy with that, appreciate that it’s not that easy to actually implement.