How to Create Dynamic Values for a Custom Field
Dynamic Values are a set of rules that generate a value based on predefined criteria. These rules can be static, number-based, date-based, or derived from relation fields. When set up, Dynamic Values ensure that a value is generated and assigned to a chosen custom field. This is particularly useful for assigning user-friendly identifiers, such as customer IDs, project IDs, or task IDs, rather than relying on database IDs.
Step-by-Step Instructions
Step 1: Navigate to Module Settings
- Navigate to Module settings.
Step 2: Open the Dynamic Values Section
-
Click "Dynamic values".
Step 3: Create a New Dynamic Value
-
Click "CREATE".
Step 4: Assign a Name
-
Assign a name for the dynamic value.
Step 5: Choose a Custom Field
-
Choose a custom field the dynamic value should be added to when an item is created.
Tip: The custom field you choose should be of a type that is able to hold the information generated by the system. If you are unsure which to choose, a "String" type field is the most versatile.
Step 6: Select Relevant Module Item Types
-
Choose which module item types the dynamic value is relevant for.
Step 7: Ensure Uniqueness
-
Select "Unique value" if you want the system to ensure no two equal values are generated.
Step 8: Generate Value Configuration
-
To easily generate a value configuration, use the chat functionality and press send.
Step 9: Preview Generated Values
-
The system will now show a preview of the next 10 values to be assigned. This will ensure the result you are looking for is achieved.
Step 10: Edit Configuration Directly in JSON
- You can also change the configuration directly from the JSON editor.
Step 11: Save the Dynamic Value
- Press "Save" to finish.
Step 12: Verify Creation
-
The new Dynamic value is created.
JSON Configuration dynamic value
Dynamic Value Object
Property | Type | Description |
---|---|---|
rules | Array | An array of strings storing the value each rule generated last time |
meta | Array | - |
lastOutput | string | The last generated value is stored for reference; it has no functional meaning |
Rules
There are multiple types of rules, each with its own set of parameters. A combination of rules allows for the creation of unique Dynamic Values.
Static
{
"rules": [
{
"type": "static",
"value": "Any freetext value"
}
]
}
Number
{
"rules": [
{
"type": "number",
"stepSize": 1,
"direction": "asc", // asc or desc
"start": 1,
"zeroPad": 0
}
]
}
Date
{
"rules": [
{
"type": "date",
"format": "Y-m-d",
"stepSize": 0,
"stepSizeType": "day",
"direction": "asc", // asc or desc
"start": "today" // use a date or e.g., today/yesterday/tomorrow
}
]
}
Format, stepSizeType and start accepts valid PHP date formats. For more information, please visit PHP Date Formats