preserving Files extentions when dropping into related items
Hi Roo,
Yep, you can extract the file extension by this code:
Yep, you can extract the file extension by this code:
Code: Select all
listItem.get_fieldValues().File_x0020_Type
For Some reason this Has stopped functioning?? i've deleted the form and rebuild. Im completely lost as it was working fine.
fd.updateDroppedDocuments($('.RTWForm'), function(listItem) {
//get the values from the Form fields:
var fidr = parseInt(window.top.GetUrlKeyValue('ID'));
var prefixr = Date.now()/ 1000 | 0;
var Employeer = fd.field("Employee_x0020_Name").control('data')['Employee_x0020_Name'];
var rdater = fd.field("RecordedDate").value();
var extnr = listItem.get_fieldValues().File_x0020_Type
var newNamer = prefixr + " " + fidr + " " + Employeer + "." + extnr;
//file name with the current directory:
var newFileNamer = listItem.get_item('FileDirRef') + '/' + newNamer;
//set the values on uploaded document:
listItem.set_item('Title', fidr);
listItem.set_item('Employee_x0020_Name', Employeer);
listItem.set_item('RecordedDate', rdater);
listItem.update();
listItem.update();
listItem.get_file().moveTo(newFileNamer);
});
fd.updateDroppedDocuments($('.RTWForm'), function(listItem) {
//get the values from the Form fields:
var fidr = parseInt(window.top.GetUrlKeyValue('ID'));
var prefixr = Date.now()/ 1000 | 0;
var Employeer = fd.field("Employee_x0020_Name").control('data')['Employee_x0020_Name'];
var rdater = fd.field("RecordedDate").value();
var extnr = listItem.get_fieldValues().File_x0020_Type
var newNamer = prefixr + " " + fidr + " " + Employeer + "." + extnr;
//file name with the current directory:
var newFileNamer = listItem.get_item('FileDirRef') + '/' + newNamer;
//set the values on uploaded document:
listItem.set_item('Title', fidr);
listItem.set_item('Employee_x0020_Name', Employeer);
listItem.set_item('RecordedDate', rdater);
listItem.update();
listItem.update();
listItem.get_file().moveTo(newFileNamer);
});
Dear Roo,
The same functionality works on my test tenant.
1) Have you noticed any errors in the browser console? If so, please send us a screenshot.
2) Have you tried to rebuild the form with the same related Documents library or with a brand new one? Could you please try to create a new Documents library and try to build a form with it?
The same functionality works on my test tenant.
1) Have you noticed any errors in the browser console? If so, please send us a screenshot.
2) Have you tried to rebuild the form with the same related Documents library or with a brand new one? Could you please try to create a new Documents library and try to build a form with it?
-
- Information
-
Who is online
Users browsing this forum: No registered users and 25 guests