Create or Update Record
Add a new record to a table or update an existing record if it already exists. You can also link this record to other records in your system.
Technical Name: InsertMDataFunc
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: CRUD Operations
- Function ID:
3f9a1ea8-5d9a-4f2b-a8f6-8f6b5d9a1ea9
Input Schema
Required Parameters
| Parameter | Type | Description |
|---|---|---|
data | object | The data to insert or update |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (uuid) | ID of the record to update (creates new if not provided) |
mobjectId | string (uuid) | The Object to insert data into |
[Image placeholder: InsertMData function configuration panel]
Input Example
{
"mobjectId": "3f9a1ea8-5d9a-4f2b-a8f6-8f6b5d9a1ea9",
"data": {
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"status": "Active"
}
}Output Schema
The function returns the created or updated MData record:
| Field | Type | Description |
|---|---|---|
id | string (uuid) | The unique identifier of the record |
mobjectId | string (uuid) | The Object ID this record belongs to |
data | object | The stored data |
createdAt | string (date-time) | Timestamp when the record was created |
updatedAt | string (date-time) | Timestamp when the record was last updated |
Output Example
{
"id": "7f8a2ea8-6d9a-5f3b-b9f7-9f7b6d9a2eb1",
"mobjectId": "3f9a1ea8-5d9a-4f2b-a8f6-8f6b5d9a1ea9",
"data": {
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"status": "Active"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}[Image placeholder: InsertMData output visualization]
Use Cases
Creating New Records
Use InsertMData to create new records without providing an id:
{
"mobjectId": "customer-mobject-id",
"data": {
"name": "Jane Smith",
"email": "jane@example.com"
}
}Updating Existing Records
Provide an id to update an existing record:
{
"id": "existing-record-id",
"mobjectId": "customer-mobject-id",
"data": {
"status": "Inactive",
"lastModified": "2024-01-15"
}
}Working with Relationships
InsertMData supports relationships through reference fields:
{
"mobjectId": "order-mobject-id",
"data": {
"orderNumber": "ORD-001",
"customerId": "customer-record-id",
"items": [
{"productId": "prod-1", "quantity": 2},
{"productId": "prod-2", "quantity": 1}
]
}
}Workflow Example
A typical workflow using InsertMData:
Start → ValidateInput → InsertMData → EmailNotification → End[Image placeholder: Workflow diagram showing InsertMData in context]
Error Handling
Common errors and how to handle them:
Validation Errors
{
"error": "Validation failed: email field is required",
"timestamp": "2024-01-15T10:30:00Z"
}Permission Errors
{
"error": "User does not have permission to insert data in this Object",
"timestamp": "2024-01-15T10:30:00Z"
}Best Practices
- Always validate input data before calling InsertMData
- Use bulk operations when inserting multiple records (see BulkInsertMData)
- Handle errors gracefully with proper error checking nodes
- Set appropriate field mappings for reference fields
- Use transactions for related inserts to maintain data integrity
Related Functions
- BulkInsertMData - Insert multiple records at once
- FetchMData - Retrieve records after insertion
- DeleteMData - Delete records
External Data Source Configuration
The mobjectId parameter supports external data source configuration for dropdown selection:
{
"externalDataSource": {
"source": "mobject",
"sourceField": "name"
}
}This allows you to select the Object by name in the workflow designer.
[Image placeholder: Object selector dropdown]