Deleting Organizational Units (2.35)

Hi,

I have deployed 2.35 on my server, is there any new approach to removing Organizational Units with NO DATA and ALL CHILDREN removed? I see a query on github but it’s from 2018? Does this still apply? Is there another solution? Many thanks😊

Hello, You can use the import/export app (medata import) with import strategy delete and pass a json file with the list of org Units to delete.


Format of the json file:

{
    "organisationUnits": [
        {
            "id": "e7UkK8f1Xrs"            
        },
        {
            "id": "e7UkK8f1Xrs"            
        }
    ]
}

Regards,

4 Likes

Many Thanks Mamadou!

Bonjour Mamadou,

So this happens when I pass the above statement. The dry run shows no errors, but the import shows like the screen gab below:

Have you experienced this before?

Merci!

Hello,

If you have access to the logs it will help.
Sometimes, it’s because there is a dataVAlue attached to orgUnits.

Thanks,

Bonjour Diallo,

I resolved the problem, looked at the catalina logs and found a foreign key constraint which in this case a reference in category options… Remove them and was thus able to delete the organizational units.

Merci Beaucoup

2 Likes

Hello DHIS2 mates!

And it is possible to do this bulk deletion of org units with children and without data with an API call?

Thanks!

1 Like