Versions Compared

Key

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

On a per form basis, you can write SQL transactions that run on submission.  Use this functionality create unique ID's that can be bound to the transaction (Requsition ID, Expense Report ID, etc.), or to save data from the submission to a SQL Data source.  You will need to configure GlobalForms to support SQL connections if you haven't already done so.

Navigate to the GlobalForms installation directory in Windows Explorer and open the config folder.  Open the file config.json in a text editor and find the mssql section.  It will looks similar to this:


Code Block
languagexml
titleMSSQL Configuration
      "mssql": {
        "host": "Square9SQL\\GETSMART",
        "port": "1433",
        "database": "FormsControl",
        "user": "node",
        "password": "node"
      }

Modify the settings in this configuration section for your specific environment.  Remember, your SQL Server instance must be setup to listen on the TCP/IP protocol.  The the changes and restart the GlobalForms service for the changes to take effect.

In this example, you will enter a First Name and Last Name to be inserted into an Employees table.  The table includes an auto-incrementing Identity column that will be used as an employee ID.  The script to create that table is below for reference:

...

  1. You do not need to insert data into the ID column.  This column is an Identity column and any insert will automatically calculate the value of this column.

  2. The value inserted into the identify column is mappable in the GlobalForms mapping utility.  This allows you to leverage this data in a GlobalCapture workflow if desired.  For example, in a PO example, you may wish to send an email to the form submitter notifying them of the PO for their request.  

  3. Data from the form is accessible in the SQL Statement and is accessed using the data variable, as is the case in most rules in the GlobalForms application.  Wrapping the variables in Handlebars {{ }} allows GlobalForms to discern between a literal string you are looking to insert and data entered into the form.

Click the Save Action button to save the changes.  Test the insert by submitting the form.  You should see the submitted data inserted into the SQL Table.