Multiple lookups on related items - Problems
Posted: 08 Oct 2018
I've got 3 questions/Problems with related items.
I have a parent form that has a lookup field (Employee name) and a Recorded date (the date is set to today)
I have a related item (child) which points to a document library file. In the child library I also have a Employee Name and a Recorded Date field.
Problem 1. When I drag a new document into the form the date format in the child library is in US:
Problem 2
I want to create two filters form the related items and have used some of the code shown previously in the forums
//first filter on page load
setHash();
fd.updateDroppedDocuments($('.SCForm'), function(listItem) {
//get the values from the Form fields:
var employee = fd.field("Employee_x0020_Name").control('data')['Employee_x0020_Name'];
var rdate = fd.field("RecordedDate").value();
//set the values on uploaded document:
listItem.set_item('Employee_x0020_Name', employee);
listItem.set_item('RecordedDate', rdate);
listItem.update();
});
//and attach an on-change handler that will call the filtering function wherever the value of the field changes
fd.field('Employee_x0020_Name').change(setHash);
fd.field('RecordedDate').change(setHash);
//this is the actual function that filters the list
function setHash(){
//get value
var value = fd.field('Employee_x0020_Name').value();
if (!value) {
value = "";
}
var value2 = fd.field('RecordedDate').value();
if (!value2) {
value2 = "";
}
value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
value2 = encodeURIComponent(escape(value2)).replace(/\-/g, "%252D");
//set the URL’s hash value. An explanation on this is at the end of the article.
window.location.hash = "InplviewHash" + $(".SCForm [webpartid]").attr("webpartid") + '=FilterField1=Employee_x0020_Name-FilterValue1=' + value + '-FilterField2=RecordedDate-FilterValue2=' + value2;
}
I can't seem to get this working - I've manually changed the date as shown in problem 1 - so it doesn't seem to be this causing the problem.
Problem 3
When I remove all the JS on the form and just have a basic filter - the related items are still not showing. for some reason I have a strage filter showing it I manually try and change it:
I have a parent form that has a lookup field (Employee name) and a Recorded date (the date is set to today)
I have a related item (child) which points to a document library file. In the child library I also have a Employee Name and a Recorded Date field.
Problem 1. When I drag a new document into the form the date format in the child library is in US:
Problem 2
I want to create two filters form the related items and have used some of the code shown previously in the forums
//first filter on page load
setHash();
fd.updateDroppedDocuments($('.SCForm'), function(listItem) {
//get the values from the Form fields:
var employee = fd.field("Employee_x0020_Name").control('data')['Employee_x0020_Name'];
var rdate = fd.field("RecordedDate").value();
//set the values on uploaded document:
listItem.set_item('Employee_x0020_Name', employee);
listItem.set_item('RecordedDate', rdate);
listItem.update();
});
//and attach an on-change handler that will call the filtering function wherever the value of the field changes
fd.field('Employee_x0020_Name').change(setHash);
fd.field('RecordedDate').change(setHash);
//this is the actual function that filters the list
function setHash(){
//get value
var value = fd.field('Employee_x0020_Name').value();
if (!value) {
value = "";
}
var value2 = fd.field('RecordedDate').value();
if (!value2) {
value2 = "";
}
value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
value2 = encodeURIComponent(escape(value2)).replace(/\-/g, "%252D");
//set the URL’s hash value. An explanation on this is at the end of the article.
window.location.hash = "InplviewHash" + $(".SCForm [webpartid]").attr("webpartid") + '=FilterField1=Employee_x0020_Name-FilterValue1=' + value + '-FilterField2=RecordedDate-FilterValue2=' + value2;
}
I can't seem to get this working - I've manually changed the date as shown in problem 1 - so it doesn't seem to be this causing the problem.
Problem 3
When I remove all the JS on the form and just have a basic filter - the related items are still not showing. for some reason I have a strage filter showing it I manually try and change it: