Making transactions fields mandatory
  • Nat
    Making transactions fields mandatory

    by Nat » Fri Apr 28, 2006 7:30 am

    Hi,

    Is it possible to force users to fill in certain fields on transactions, such as the reference field? If so, how would I go about doing that?

    Thanks.
  • COBS Tech Support
    Posts:683
    Joined:Fri Sep 09, 2005 8:23 am

    by COBS Tech Support » Fri Apr 28, 2006 7:32 am

    You can make certain fields on transactions mandatory by using the appropriate hook scripts in conjunction with the IsEmpty() and ReadTranValue() functions.

    The fields you can check the values for are listed inside the topic relating to ReadTranValue().

    For invoicing, create a text file called R-ITOTAL.MAC and place this text inside the file:

    If IsEmpty(ReadTranValue("REFERENCE"))
    Echo("Sorry, please fill in the reference field")
    Return FALSE
    Endif

    Return TRUE

    Change the field "REFERENCE" to the field that you don't want to be blank. You can add multiple statements after the first If...Endif block of text, before the Return TRUE statement, if required. E.g.,

    If IsEmpty(ReadTranValue("OURREF"))
    Echo("Sorry, please fill in the auxiliary reference field")
    Return FALSE
    Endif

    If IsEmpty(ReadTranValue("OURREF2"))
    Echo("Sorry, please fill in the second auxiliary reference field")
    Return FALSE
    Endif

    Return TRUE

    And so on.

    To have this script affect all companies, place it in the \CAPITAL folder. To have the script affect the operations of a specific company only, place it in the \CAPITAL\XXX folder where XXX is the name of the company you want to affect.

    For the names of other script hook files consult the help topic: "Other Transaction Pre-Saving Hooks".

Who is online

Users browsing this forum: No registered users and 19 guests