process_list_by_object()
Returns the workflow processes whose file contains a given DMS object via
wfm.GetProcessListByObject.
1. Signature
-
Sync
-
Async
ecm.workflow.process_list_by_object(
obj: int | ECMWorkspaceDocument | ECMFolderModel | ECMRegisterModel | ECMDocumentModel,
organisation: str | ECMOrganisation | None = None,
*,
user: str | ECMOrganisationObject | ECMOrganisationObjectRef | None = None,
all_processes: bool = False,
) -> list[ECMObjectProcess]
await ecm.workflow.process_list_by_object(
obj: int | ECMWorkspaceDocument | ECMFolderModel | ECMRegisterModel | ECMDocumentModel,
organisation: str | ECMOrganisation | None = None,
*,
user: str | ECMOrganisationObject | ECMOrganisationObjectRef | None = None,
all_processes: bool = False,
) -> list[ECMObjectProcess]
2. Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
The DMS object: its numeric ID, an |
|
|
The organisation as a GUID or as an |
|
|
Optional workflow-organisation user. When given, |
|
|
|
3. Return value
A list of ECMObjectProcess instances in server order. Returns an empty list when no
process holds the object.
Measured on enaio 12.0:
-
An unknown object ID is not an error; the server answers
<Processes><Resources/></Processes>, which reads as an empty list. -
Ended processes are listed only with
all_processes=True, with state16(TERMINATED) and an emptyactivitiestuple. -
activitiesholds the activities that currently have a work item. Right afterstart_process()it is still empty until the engine has created the first work item, about three seconds later; the activity then appears with state64and no owner. -
An unknown, empty or foreign
userGUID is accepted and simply yieldsis_process_responsible = False.
3.1. ECMObjectProcess fields
| Field | Type | Description |
|---|---|---|
|
|
GUID of the process instance ( |
|
|
Instance name of the process ( |
|
|
Subject of the process ( |
|
|
Raw process state ( |
|
|
GUID of the workflow-organisation user who started the process ( |
|
|
Display name of that user ( |
|
|
Start time as a UTC |
|
|
|
|
|
The activities currently holding a work item. Empty for ended processes and for a moment after the start. |
|
|
Instance name per locale, resolved from the |
|
|
Subject per locale, resolved via |
3.2. ECMObjectProcessActivity fields
| Field | Type | Description |
|---|---|---|
|
|
Technical activity name ( |
|
|
Raw activity-state bitmask ( |
|
|
End time as a UTC |
|
|
Name of the user currently owning the activity ( |
|
|
GUID of the owning user ( |
|
|
The organisation objects the activity is addressed to ( |
|
|
Activity name per locale, resolved via |
3.3. ECMObjectProcessPerformer fields
| Field | Type | Description |
|---|---|---|
|
|
GUID of the workflow-organisation object ( |
|
|
Display name of the organisation object ( |
|
|
E-mail address ( |
|
|
|
|
|
|
|
|
|
|
|
Raw performer flags ( |
|
The server manual documents only flat attributes on |
4. Examples
4.1. Processes of a document
-
Sync
-
Async
for process in ecm.workflow.process_list_by_object(document_id):
owners = ", ".join(a.owner or "-" for a in process.activities)
print(f"{process.name} ({process.state}) owned by {owners}")
for process in await ecm.workflow.process_list_by_object(document_id):
owners = ", ".join(a.owner or "-" for a in process.activities)
print(f"{process.name} ({process.state}) owned by {owners}")
4.2. Including ended processes, from a loaded model
-
Sync
-
Async
document = ecm.dms.get(Invoice, document_id)
processes = ecm.workflow.process_list_by_object(document, all_processes=True)
ended = [p for p in processes if p.state & 16]
document = await ecm.dms.get(Invoice, document_id)
processes = await ecm.workflow.process_list_by_object(document, all_processes=True)
ended = [p for p in processes if p.state & 16]
4.3. Responsibility of a user
-
Sync
-
Async
user = ecm.workflow.organisation_user_by_login("root")
for process in ecm.workflow.process_list_by_object(document_id, user=user):
print(process.name, process.is_process_responsible)
user = await ecm.workflow.organisation_user_by_login("root")
for process in await ecm.workflow.process_list_by_object(document_id, user=user):
print(process.name, process.is_process_responsible)
5. See also
-
process_list_by_user()— the processes in a user’s inbox -
start_process()— start a process with documents in its file -
organisation_objects()— resolve workflow-organisation users