Multiple Document - Rename
Good Afternoon,
I have a Related Document Control setup on a Display Form to allow users to drag and drop new documents, with script to set the metadata and also to rename the document. The functionality seems to work fine if a user only drops one document onto the Related Document Control, however, if the user then attempts to drop another they are presented with a message stating -"There is an upload is in progress. Please wait until the current upload has finished." with an option to close the message. The only option is for the user to refresh the page, the Document will then show and all seems to be ok.
If a user drops multiple items onto the Control only the first item gets the meta data set against it and renamed, and again the same message as before is displayed if a user attempts to add more documents.
My code is
I have checked the console and there does appear to be an error message following dropping a document, I have attached a screenshot...
I can't see where I am going wrong...
Thanks
I have a Related Document Control setup on a Display Form to allow users to drag and drop new documents, with script to set the metadata and also to rename the document. The functionality seems to work fine if a user only drops one document onto the Related Document Control, however, if the user then attempts to drop another they are presented with a message stating -"There is an upload is in progress. Please wait until the current upload has finished." with an option to close the message. The only option is for the user to refresh the page, the Document will then show and all seems to be ok.
If a user drops multiple items onto the Control only the first item gets the meta data set against it and renamed, and again the same message as before is displayed if a user attempts to add more documents.
My code is
Code: Select all
// Add Parent ID to uploaded email for retrieval
fd.updateDroppedDocuments($('.documentUploadRICssClass'), {
Company_x0020_Name: '{CurrentItem}'
});
// Update Uploaded Document for Relevant fields
fd.updateDroppedDocuments($('.documentUploadRICssClass'), function(listItem) {
//get the values from the Form fields:
var contactName = getPrimaryContactName();
var addressName = getAddressName();
var currentName = listItem.get_fieldValues().FileLeafRef;
var prefix = Date.now() / 1000 | 0;
var newName = prefix + currentName;
var documentType = $("#DocumentType option:selected").val();
var newFileName = listItem.get_item('FileDirRef') + '/' + newName;
//set the values on uploaded document:
listItem.set_item('Contact_x0020_Name', contactName);
listItem.set_item('Address_x0020_Name', addressName);
listItem.set_item('Title', currentName);
listItem.set_item('Document_x0020_Type', documentType);
listItem.update();
listItem.get_file().moveTo(newFileName);
listItem.update();
});
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
Which version of SharePoint are you using here?
Which version of SharePoint are you using here?
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
Try to remove the last listItem.update(); - it might be causing an issue here as you don't need it.
Try to remove the last listItem.update(); - it might be causing an issue here as you don't need it.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests