<@U5TF1GQ20> I believe I've narrowed it down to sh...
# suitescript
m
@battk I believe I've narrowed it down to showing a dialog and returning false, and it gets stuck in an infinite loop of dialogs. If I use a native alert it works as expected
Copy code
exports.validateField = function (context) {
    var record = context.currentRecord;

    if (
      context.sublistId !== constants.sublistIds.selectTransactions ||
      context.fieldId !== constants.sublistFieldIds.writeOffAmount
    ) {
      return true;
    }

    var writeOffAmount = record.getCurrentSublistValue({
      sublistId: constants.sublistIds.selectTransactions,
      fieldId: constants.sublistFieldIds.writeOffAmount,
    });

    var amountRemaining = record.getSublistValue({
      sublistId: constants.sublistIds.selectTransactions,
      fieldId: constants.sublistFieldIds.amountRemaining,
      line: context.line,
    });

    if (writeOffAmount < 0) {
      alert(constants.strings.writeOffCannotBeNegative);
      /* this creates an infinite loop dialog.alert({
        title: constants.strings.invalidWriteOffAmount,
        message: constants.strings.writeOffCannotBeNegative,
      });*/
      return false;
    }

    if (writeOffAmount > amountRemaining) {
      alert(constants.strings.writeOffCannotBeGreaterThanRemaining);
      /* this creates an infinite loop
      dialog.alert({
        title: constants.strings.invalidWriteOffAmount,
        message: constants.strings.writeOffCannotBeGreaterThanRemaining,
      });*/
      return false;
    }

    return true;
  };
b
my guess is focus related
m
i guess i'll live with a plain old alert ablobshrug
b
if you really like the look of netsuite's dialog, you probably want to add logic to unset your field and return true when the fields value is empty