workflow_model_by_name()
Returns a runtime-generated, typed model class for a workflow’s input variables —
conceptually analogous to ecm.dms.model_by_name. The workflow is resolved via
workflow_by_name(), its model read via
wfm.GetWorkflow, and the INOUT variable interface mapped to native Python types.
1. Signature
-
Sync
-
Async
ecm.workflow.workflow_model_by_name(
model_name: str,
user: ECMOrganisationObjectIdLike,
client_type: str | ECMClientType,
organisation: str | ECMOrganisation | None = None,
*,
include_internal: bool = False,
) -> type[ECMWorkflowModel]
await ecm.workflow.workflow_model_by_name(
model_name: str,
user: ECMOrganisationObjectIdLike,
client_type: str | ECMClientType,
organisation: str | ECMOrganisation | None = None,
*,
include_internal: bool = False,
) -> type[ECMWorkflowModel]
2. Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
|
— |
Workflow model name (see workflow_by_name()). |
|
|
— |
The workflow-organisation user. |
|
|
— |
Client type as an |
|
|
|
Defaults to the active organisation when |
|
|
|
When |
3. Return value
An ECMWorkflowModel subclass. Instances are created with the input variables as keyword
arguments; values are read/written as attributes and serialised via to_variables() (used
internally when starting).
4. Errors
-
ECMNotFoundException— no workflow with that model name -
ECMWrongStateException— more than one workflow with that model name
5. Example
Model = ecm.workflow.workflow_model_by_name("test", user, "#OSECM_Client#")
record = Model.record_model("TestRecordVar")(
StringField="x", IntegerField=1, TimeField="08:00:00",
DateTimeField="1779365400", FloatField="2.5", StringListField=["inner"],
)
instance = Model(
StringVar="hello",
IntegerVar=42,
StringListVar=["a", "b"],
TestRecordVar=record,
)
process_id = ecm.workflow.start_process(
user=user, workflow="test", client_type="#OSECM_Client#", variables=instance,
)
6. Resolve a user by login
The user parameter is the workflow-organisation GUID (not the security login). Resolve it
from a login name with ecm.workflow.organisation_user_by_login(login, organisation=None)
(matched case-insensitively against the Login attribute; ECMNotFoundException on zero,
ECMWrongStateException on several matches):
user = ecm.workflow.organisation_user_by_login("root")
Model = ecm.workflow.workflow_model_by_name("test", user, "#OSECM_Client#")
7. Static models (code generator)
For static typing / IDE completion the models can be generated as .py files — see
ecm-generate-workflow-models.
8. See also
-
workflow_by_name() — resolve a workflow
-
start_process() — start a workflow with a model
-
ecm-generate-workflow-models — generate models