Action ReferencesCreateCrudAction
Action References

CreateCrudAction

CreateCrudAction

Purpose Creates related (child or dependent) records inside another Data Object as part of the current API execution. Used for cascading inserts such as creating audit logs, attachments, or dependent tasks when a parent record is created or updated.

When to use it

  • Immediately after the parent create (afterMainCreateOperation)
  • After update (afterMainUpdateOperation) when new related entities must be inserted

Key fields

FieldTypeDescription
childObjectDataObjectNameThe Data Object where the new record(s) will be created. Can be a local data object (same service) or a remote data object (different service). For remote objects, the action automatically routes to the target service's M2M edge function (m2mCreate{ObjectName}) using secure machine-to-machine authentication. The tenant codename is automatically included in request headers for multi-tenant scenarios.
dataClause[ApiAggregateData]Array of property–value pairs to populate the new record. Each value is evaluated with MScript in the current context.
contextPropertyNameStringOptional – store the newly created record in this.<name> for later use.

Inter-Service Support

CreateCrudAction supports both local and remote data objects:

  • Local objects: The action calls the service's dbLayer utility function directly (create{ObjectName})
  • Remote objects: The action automatically routes to the target service's M2M edge function (m2mCreate{ObjectName}) using secure machine-to-machine authentication. This enables seamless inter-service CRUD operations without manual API calls.

For multi-tenant services, the tenant codename is automatically propagated to the remote service via the mbx-{tenantName}-codename header.

Example

{
  "id": "a110-create-log",
  "name": "createAuditLog",
  "childObject": "auditLog",
  "dataClause": [
    { "dataProperty": "objectId", "dataValue": "this.project.id" },
    { "dataProperty": "message", "dataValue": "`Project created by ${this.session.userId}`" },
    { "dataProperty": "isActive", "dataValue": "true" }
  ],
  "contextPropertyName": "logEntry"
}
Was this page helpful?
Built with Documentation.AI

Last updated Jan 3, 2026