ID Generator Field

The ID Generator Field in Joget's Form Builder produces a running number based on an App Variable. This is particularly useful for generating unique identifiers for records in a form. To learn more about its usage, see Generate Reference ID.

You only need to adjust the database isolation level using MySQL, as other databases already default to READ-COMMITTED.
Run the following queries in MySQL:
SET GLOBAL tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-COMMITTED';
Add the following to your my.cnf/my.ini file:
[mysqld]
transaction-isolation = READ-COMMITTED

Add an ID Generator element

Use the built-in App Expenses Claims to see how the ID Generator field works. Follow these steps:

  1. On a form, Drag and drop an ID Generator Element
  2. Click the ID Generator Field element on the canvas to open up the Configure ID Generator Field properties.
  3. Take note of the Format.
  4. To see it working, head to the App Composer and click the Launch button in the UI column.
  5. Click the Create a New Expense Claim button on the Dashboard, fill in the necessary details, and click the Continue Next Screen button.
  6. Click on the Save As Draft button.
  7. Go to My Expenses on the menu at the top and click My Inbox. The ID generator has generated a 4-digit running number (as defined in the Format field in Step 3) under the # column.

Configure the ID generator field

Configuring the ID Generator Field involves setting the ID, label, app variable name, format, and advanced options to ensure the element generates unique IDs as required.

Fill in the following fields:

  • ID: Element ID. By declaring as ref, a corresponding database table column c_ref will be created. See Form Element for more information about defining the ID and a list of reserved IDs.
    Note: When using this element in a workflow process, do not set the ID as id, as it will not be associated with the process instance's ID.
  • Label: The element label is to be displayed to the end-user.
  • App Variable Name: Name of the app variable to be used to keep the running number.
  • Format: Determines the pattern of the generated value (e.g., REF-????? will yield REF-00001).

Advanced options

Advanced options provide additional settings for visibility, workflow integration, and unique ID generation.

UI

Fill in the following fields:

  • Hidden?: Determines if the element should be made visible in the form.

Workflow

Workflow settings integrate the Date Picker with workflow processes, allowing values to be saved and used within workflow variables. 

Fill in the following fields:

  • Workflow Variable: If the form is part of a workflow process, upon saving the form by clicking Save as Draft or Complete, the value in this input field will be saved into the corresponding workflow variable named in this field.

Using a non-existent Workflow Variable name
You will get a warning with the name printed out (e.g., status) in the server log if you attempt to map to a non-existent Workflow Variable.
context attribute status does not exist in process context - adding new attributes to the process 

ID generation method

Fill in the following fields:

  • Distributed Unique ID: Generates a distributed sequential unique ID.
    It is advisable to use Distributed Unique ID when dealing with high loads of ID generation to avoid performance bottlenecks.

 

Related documentation

Created by Julieth Last modified by Nik Nufayl on Jan 08, 2025