Skip to main content

Workflow API

WorkflowHandle manages realm workflows.

Access

const workflow = realm.workflow('approval');

Core Methods

  • get() and getById(id)
  • create(data)
  • update(data)
  • delete()
  • ensure(data)
  • discard()
  • list({ page?, pageSize? })

Example

const workflow = await realm.workflow('approval').ensure({
enabled: true,
});

await workflow.update({
enabled: false,
});

const pageTwo = await workflow.list({ page: 2, pageSize: 10 });

Important Behavior

WorkflowHandle now follows the same lifecycle contract as the other mutable resource handles in this library.

  • update(...) updates an existing workflow.
  • ensure(...) creates the workflow if it does not exist, or updates it if it already exists.
  • The update path preserves unspecified fields by merging your partial input into the current workflow representation before sending the admin update call.