Lukasz Formela
04/01/2021, 10:03 AMvalidateField()
? Every time I try to that, it goes into (in)finite loop.
validateField() returns either result of a function call or true, function itself returns boolean only, but error appears regardless of the value. Now, it's not INfinite loop, as it takes anywhere between one and X iterations for validateField to finish - alert added below as a proof. Initially I was trying to use dialog.alert()
, but thought the error may have something to do with it's async nature (mind you, script contains some debug code/logic). Error appears both in Chrome and Firefox (but not Edge?):
function checkIfDateOrderIsCorrect(scriptContext) {
const fieldId = scriptContext.fieldId;
alert(fieldId);
if (!['custrecord_field1', 'custrecord_field2'].includes(fieldId)) {
return true;
}
return false;
}
function validateField(scriptContext) {
if (!checkIfDateOrderIsCorrect(scriptContext)) {
return false;
}
return true;
}
Sandii
04/01/2021, 2:12 PMcustrecord_field1
or custrecord_field2
your validateField is gonna return false.Lukasz Formela
04/01/2021, 2:13 PMSandii
04/01/2021, 2:17 PM//if fieldid not in my array
//return true;
//return checkerFn()
I would change to something like thatSandii
04/01/2021, 2:17 PMLukasz Formela
04/01/2021, 2:27 PMvalidateField
function and returned true regardless, still have the same issue. It happens only on date field. In the past that was a Chrome issue only, but I experience it in both Chrome and Firefox.battk
04/01/2021, 8:04 PMbattk
04/01/2021, 8:04 PMLukasz Formela
04/06/2021, 8:21 AMdialog.alert()
, that's how I found out about the date field issue. I can confirm that keeping focus on the date field doesn't initiate infinite loop any more though.battk
04/06/2021, 8:41 AMLukasz Formela
04/06/2021, 9:10 AMdialog.alert()
and set date to empty value instead, with ignoreFieldChange
flag. Seems to work both for dialog and native alert