I have two different but related questions to try to get some help with. They are both related to setting a Lookup field that has Additional Fields with it.
First is a PnP call that goes out and gets the item that is related with the lookup described above. I'm using the "select" and "expand" methods on the query but no matter what I do to the syntax, it doesn't seem to expand the lookup and its associated fields. Example code of what I'm trying to do below. There are 3 lists...Certs, Employees (not people fields) and Audits. I'm adding an item to the Audits list and on that form I'm querying the Certs list that has a lookup in it (with associated columns) that I'm trying to get the info from. But the expand doesn't seem to work. I can see the properties that come back and EmployeeId is the only field filled in.
fd.spBeforeRender(function(ctx) {
if( $.urlParam('certID') !== null) {
sp.web.lists.getByTitle('Certs').select('Title, Employee/Title, Employee/EmployeeID').expand('Employee').items.getById($.urlParam('certID')).get().then(function(item) {
cert = item;
// Set Field Values from Certification Item
if( cert !== null ) {
fd.field('Employee').value = cert.EmployeeId;
}
});
}
});
Second: when I set the Employee lookup, it works well and the lookup control is updated and displays properly. But the associated field controls related to the Employee lookup (and that are associated columns on the Audit list) don't get updated. Is there a way to get them all to update when I set the controlling Employee lookup (in the Audit list, like I'm doing in the above code segment)?
Thanks in advance