Unable to search or Create TEI once enrollment is deleted

When an enrollment is deleted users are unable to re-enter or search that particular record with a deleted enrollment, is there a way to hide the delete button on the enrollment widget?

Hey @duserik,
May I ask what is the version of the DHIS2 instance you are using? Have you tried creating roles and authorities in DHIS2?

Thank you!

Hi @Gassim

sorry for the late response, the version we are using is 2.35.8, I tried creating roles with different authorities but I didn’t seem to see those authorities.


I think there is an authority that shouldn’t be granted to the role that the user is assigned but I’m not 100% sure:

You are right, that authority can grant Delete TEI and associated enrollments and events, but the delete I want to hide (get rid of) is the one on the enrollment form, because they mistakenly use that button which doesn’t delete everything and causes later, to not be able to recreate or search it.

1 Like

Thanks @duserik! Would you like to create a feature request for this?

A workaround that I think for you is to use custom JavaScript/CSS but I’ve not been able to successfully apply that. :slightly_smiling_face:

@duserik here’s another idea that I just read from @markus:

There is a way to hide or collapse the entire widget for enrollment, so you can try it and consider whether that would be OK to directing the users away from the button.
You can change the widget layout and store your layout as default for all users.

1 Like

When a user does not have the depicted authority and the “Delete enrollment…” authority listed below it, they are not allowed to directly delete an enrollment that contains any events.



@duserik so that should work, don’t give them the ‘delete enrollment’ authority and they won’t be able to misuse that button, right? (: Thanks!

I checked the role given to those users who did that, don’t have those authorities ticked but still they can delete an enrollment; unless it is a bug in version 2.35.

Would you be able to reproduce this on play.dhis2.org? I just tried to reproduce it on DHIS 2 Demo - Sierra Leone and I wasn’t able to delete an enrollment.

To be 100% sure I’d say create a new user and only grant this user the authorities to access the Dashboard and Tracker Capture app as well as the other required authorities (except for the authority to delete an enrollment or an entity.) Additionally, assign all necessary org units and change the program sharing settings to view and edit for this user. Login to this user’s account using your browser’s incognito mode and if you are still able to delete the enrollment then it is a bug.