Conditional action on a form
In this example, the script checks form AP10 for a particular vendor class (SUP) and if true, requires the user to add an email address.
function FORM_OnBeforeTransaction(fc)
{
const sClassCheck = "SUP";
if (fc === "A" || fc === "C")
{
if (lawForm.getFormValue("text4") === sClassCheck
&& lawForm.getFormValue("text34") === "")
{
let s = "An email address (at the bottom of the Contact page) ";
s += "is required to be entered for a vendor with a ";
s += "vendor class of " + sClassCheck + ".";
portalWnd.cmnDlg.messageBox(s);
return false;
}
}
return true;
}