Hi DHIS2 Community,
I’m currently working with the DHIS2 API to merge organisation units, and I’ve encountered an unexpected behavior I hope someone can help me understand or resolve.
I’m using the /organisationUnits/merge
API endpoint to merge two org units. The merge operation itself completes successfully, and the new (merged) org unit is created as expected.
{
"sources": [
"d3hu33vHbpo",
"xQYr5E57h8K"
],
"target": "xL5orAzMbkI",
"dataValueMergeStrategy": "LAST_UPDATED",
"dataApprovalMergeStrategy": "LAST_UPDATED",
"deleteSources": true
}
However, I’ve observed that after the merge, the newly created org unit gets automatically assigned to some users, even though I haven’t explicitly updated any user assignments. This results in an incorrect organisation unit tree for those users, as seen in the user management UI.
Issue Summary:
- The newly created org unit inherits users unexpectedly.
- This leads to a misaligned org unit hierarchy for affected users, potentially impacting data access and workflows.
- I’m still investigating the exact cause, but it seems like the merge process may be updating user assignments implicitly.
Current Status:
- I’ve verified that I didn’t manually update the user assignments post-merge.
- This behavior is reproducible across multiple test cases.
DHIS2 Version 2.40.7
Has anyone experienced a similar issue? Could this be a known bug or expected behavior of the API? I would greatly appreciate any insights or suggested workarounds.
Thanks in advance!