Good Afternoon,
I am looking for a little help with additional requirements on a filtered lookup, my requirements are: -
-
I need to order the Lookup to show items by Id with the latest at the top but the default orderBy functionality seems to always order ascending and I need it to order descending.
-
I would like to catch if the filter lookup returns no results i.e. results = true or results = false.
My current code is: -
// function to filter Maintenance Contracts to only show contracts for selected addresses
function filterContract () {
var addressName = fd.field('Address_x0020_Name').value;
if (addressName == '' || addressName == null) {
fd.field('Maintenance_x0020_Contract').value = null;
fd.field('Maintenance_x0020_Contract').disabled = true;
} else {
var addressNameId = fd.field('Address_x0020_Name').value.LookupId;
fd.field('Maintenance_x0020_Contract').value = null;
fd.field('Maintenance_x0020_Contract').filter = 'Address_x0020_NameId eq ' + addressNameId;
fd.field('Maintenance_x0020_Contract').orderBy = "Id";
fd.field('Maintenance_x0020_Contract').widget.dataSource.read();
fd.field('Maintenance_x0020_Contract').disabled = false;
}
}
Hopefully you can assist with the above.
Thanks