Page 1 of 1

SCRIPT SAMPLE: Making Quote Fields Mandatory

Posted: Thu Sep 14, 2017 3:39 pm
by COBS Tech Support
Here is a sample script that demonstrates how to make certain selected quote fields mandatory fields:

Code: Select all

* COBS, 14/09/2017
* Specify Mandatory Fields when saving quotes
Declare cField Type Character
Declare aRequired Type Array
Declare aError    Type Array
Declare nCount Type Number

nCount    := 1
aRequired := { "REFERENCE", "EMAIL", "ORDEREDBY", "QREF1", "PROMO", "ORIGIN", "CATEGORY", "PRIORITY" }
aError    := { "Order Number", "Email Address", "Ordered By", "Area", "Promotional Code", "Origin Code", "Category", "Priority Level" }

:Loop
   If nCount > Len(aRequired)
      Return TRUE
   Endif

   cField := ReadTranValue(aRequired[nCount])

   If IsEmpty(cField)
      EchoWarn("Sorry, the input field '" + aError[nCount] + "' cannot be left blank. Please assign it a value before proceeding.")
      Return FALSE
   Endif

   nCount := nCount + 1
   Goto Loop