Actions18
- Analytics Actions
- Data Value Set Actions
- Enrollment Actions
- Event Actions
- FHIR Actions
- Organisation Unit Actions
- Program Actions
- Tracked Entity Actions
Enrollment → Create
AI-generatedSummary
Enrolls a tracked entity into a DHIS2 program by POSTing a single enrollment, supplied as a JSON payload, to the DHIS2 Tracker API (/api/tracker).
Inputs
- enrollmentPayload (required) — JSON object describing the enrollment. Per the description it must include trackedEntity, orgUnit, program and enrolledAt. The default template also has occurredAt. Accepts a JSON string or an object (e.g. from an expression). It is parsed and wrapped as { enrollments: [payload] } before sending. The node does not validate the fields itself, so DHIS2 reports any missing ones.
Output shape
One output item per input item, containing the parsed JSON response from DHIS2's POST /api/tracker call (typically an import report with status and stats).
Uses the dhis2Api credentials. If the response has no organisationUnits, programs, instances or dataValues key, it is returned as one item. With Continue On Fail enabled, a failed item yields { error: message } instead of stopping the run. Otherwise errors are thrown as NodeApiError. Invalid JSON in the payload also counts as an error. The request sends no query string, so the endpoint's default import parameters apply.
Examples
Example 1: Enroll a newly registered person into a program
Resource: Enrollment, Operation: Create. Payload set to {"trackedEntity":"{{$json.teiId}}","orgUnit":"OU_UID","program":"PROGRAM_UID","enrolledAt":"2024-05-01","occurredAt":"2024-05-01"}.