Dropped Document - Multi Select Lookup Field
Posted: 16 Jul 2018
Good Morning,
I am using the update Dropped Documents function on a related Document control and want to update a Multi-Select Lookup Field with 2 (or More) values, my code is below.
The two fields I want to use are Company Name ('Company_x0020_Name') & Correspondence Company Name ('Correspondence_x0020_Company_x000'), I need these to go into the Muli-Select Lookup field called Company Name ('Company_x0020_Name'), currently on the first one is going into the field, could you advise please.
Thanks
Tony
I am using the update Dropped Documents function on a related Document control and want to update a Multi-Select Lookup Field with 2 (or More) values, my code is below.
The two fields I want to use are Company Name ('Company_x0020_Name') & Correspondence Company Name ('Correspondence_x0020_Company_x000'), I need these to go into the Muli-Select Lookup field called Company Name ('Company_x0020_Name'), currently on the first one is going into the field, could you advise please.
Thanks
Tony
Code: Select all
// Add Parent ID to uploaded Document for retrieval
fd.updateDroppedDocuments($('.documentUploadRICssClass'), {
Solutions_x0020_Quote_x0020_Reference: '{CurrentItem}'
});
// Update Uploaded Document for Relevant fields
fd.updateDroppedDocuments($('.documentUploadRICssClass'), function(listItem) {
debugger;
//get the values from the Form fields:
var companyName = fd.field('Company_x0020_Name').value();
var correspondenceCompanyName = fd.field('Correspondence_x0020_Company_x000').value();
var companyNames = (companyName+","+correspondenceCompanyName);
var addressName = fd.field('Address_x0020_Name').value();
var contactName = fd.field('Contact_x0020_Name').value();
var correspondenceAddressName = fd.field('Correspondence_x0020_Address_x000').value();
var correspondenceContactName = fd.field('Correspondence_x0020_Contact_x000').value();
var currentName = listItem.get_fieldValues().FileLeafRef;
var prefix = Date.now() / 1000 | 0;
var newName = prefix + '-' + currentName;
var documentCategory = fd.field('Document_x0020_Category').value();
var newFileName = listItem.get_item('FileDirRef') + '/' + newName;
//set the values on uploaded document:
listItem.set_item('Company_x0020_Name', companyNames);
listItem.set_item('Address_x0020_Name', addressName);
listItem.set_item('Contact_x0020_Name', contactName);
listItem.set_item('Title', currentName);
listItem.set_item('Document_x0020_Category', documentCategory);
listItem.update();
listItem.get_file().moveTo(newFileName);
});