Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Remember if routing for approval and using PreSubmit API, PreSubmit is a catch all that will be triggered on submit, approval, or rejection.

PreApproval / PreReject

...

The PreApprove and PreReject API’s work in exactly the same way as the PreSubmit API. However PreApprove will only trigger when a user approves a routed form, and PreReject will only trigger when a user rejects a form.

Code Block
        function PreReject() {
            let canReject = true
            //on rejection sets value of formRouted to Null
            $('#formRouted').val('')
            $('#formRouted').trigger('change')

            Forms_inMotion("elementdataupdate")

            var object = {
                canReject: canReject,
                errorMessage: "Required fields are missing, please fill out fields highlighted in red."
            }

            return object;
        }

        function PreApprove() {
            let canApprove = true
            //On approve routingCheck and validateDept are called to determine if the 
            //form can be submitted
            canApprove = routingCheck()
            canApprove = validateDept()
            Forms_inMotion("elementdataupdate")
            var object = {
                canApprove: canApprove,
                errorMessage: "Required fields are missing, please fill out fields highlighted in red."
            }

            return object;
        }

Page Properties
hiddentrue

Related issues