Hello @cwalter2,
You need to debug your code, please find suggestions in this post:
I can only give you some suggestions:
-
Use RequireJS library to load external scripts, thus you can remove
window.define = null;
line. Please find the code example in * Work with Date and Time fields article. -
If there is no value selected in the lookup field, you get the error:
function filterProjectContacts () {
//alert('change caught');
var contractorId = fd.field('ProjectContractorLookUp').value.Contractor.Id;
//alert(contractorId);
fd.field('ProjectContactLookUp').filter = 'CLCompany/Id eq ' + contractorId + " and CLActive eq 'Active'";
fd.field('ProjectContactLookUp').orderBy = {field: 'CLDispName', asc: true};
fd.field('ProjectContactLookUp').widget.dataSource.read();
}
You can add a condition to check if any value is selected to prevent errors.
function filterProjectContacts () {
if(fd.field('ProjectContractorLookUp').value){
var contractorId = fd.field('ProjectContractorLookUp').value.Contractor.Id;
//alert(contractorId);
fd.field('ProjectContactLookUp').filter = 'CLCompany/Id eq ' + contractorId + " and CLActive eq 'Active'";
fd.field('ProjectContactLookUp').orderBy = {field: 'CLDispName', asc: true};
fd.field('ProjectContactLookUp').widget.dataSource.read();
}
}
3.