customizeERP Function – Parameters Explanation
The customizeERP function receives two parameters, where the first one, userData, plays a critical role in conveying the input data associated with the request. The structure of userData varies based on the type of operation being customized and whether the customization is applied to a main or related table.
1. userData Parameter
This object contains the data payload relevant to the specific CRUD operation. Here's how it is structured for each type of request:
Create
{
"__d3__newData": {}
}If you are customizing Create logic for a related table, then the userData will look like:
{
"__d3__newData": {},
"__d3__parentId": 1,
"__d3__relationId": "ID of the relation"
}Read
{
"__d3__filterdata": {
"where": {}
}
}If you are customizing Read logic for a related table, then the userData will look like:
{
"__d3__filterdata": {
"where": {}
},
"__d3__parentId": 1,
"__d3__relationId": "ID of the relation"
}To fetch a specific number of records, you can add a limit key:
{
"__d3__filterdata": {
"where": {},
"limit": 100
}
}| limit Value | Result |
|---|---|
| Not provided | Defaults to 10 records |
| A number (e.g., 50) | Returns that many records |
| null | Returns all records |
Update
{
"__d3__newData": {},
"__d3__id": 1
}If you are customizing Update logic for a related table, then the userData will look like:
{
"__d3__newData": {},
"__d3__id": 1,
"__d3__parentId": 1,
"__d3__relationId": "ID of the relation"
}Delete
{
"__d3__id": [1]
}If you are customizing Delete logic for a related table, then the userData will look like:
{
"__d3__id": [1],
"__d3__parentId": 1,
"__d3__relationId": "ID of the relation"
}Form Customization
Form customization allows you to manipulate the behavior, structure, or content of forms within Supista ERP. The userData parameter in this context includes vital information needed to render and manage the form.
You can destructure the data as follows:
const { __d3__formData, __d3__error, __d3__schema } = userData;Parameter Breakdown:
-
__d3__formData: Contains the actual data being used within the form. This includes both default values and any existing record data (in edit mode). -
__d3__error: Captures any errors that occur during form loading or processing. This can be used to implement custom error handling or fallback behaviors. -
__d3__schema: Represents the schema associated with the form. It defines the structure, validation rules, and data types, enabling advanced customizations like dynamic field rendering or conditional visibility.
Action Buttons
Custom action buttons allow you to trigger operations based on user-selected records, such as bulk updates, conditional workflows, or third-party integrations.
In this case, the userData parameter consists of an array of objects, each representing a selected row.
Sample userData:
[
{
"columnName1": "Column Value 1",
"columnName2": "Column Value 2",
"columnName3": "Column Value 3"
},
{
"columnName1": "Column Value 1",
"columnName2": "Column Value 2",
"columnName3": "Column Value 3"
}
]Usage Notes:
- Each object corresponds to a record selected in the UI.
- The array supports both individual and bulk operations, making it ideal for batch processing or row-level custom logic.
- You can iterate through this array and apply logic conditionally based on record fields.
