Cannot invoke "org.hisp.dhis.dataelement.DataElement.getDisplayFormName()" because "dataElement" is null

I tried to change the name of my program rule variable. After changing the name of my program rule variable, I tried to replace the old variable with new one. While doing this, I encountered with the following error:

Cannot invoke “org.hisp.dhis.dataelement.DataElement.getDisplayFormName()” because “dataElement” is null

Please help me with this error.

Hi @riwaj.amakomaya

The naming seems okay, but maybe while updating the name of the program rule variable, some changes happened. Could you check the configuration of the program rule variable? Please take a screenshot if possible.

Thanks!

I have selected the related TEA with the program rule variable, still there shows an error. The issue is on all the program rules related with this program.

What happens if you recreate a new program rule variable with the same settings rather than renaming it?

Okay, thanks for the clarification. The issue is not specifically to this program rule variable…

We need to understand where the issue is coming from exactly. Are all the program rules showing this same error?

Thanks!

The issue is same in all of the program rules of this program. As soon as I type anything in the expression field, the following error is displayed. It is not specially to this program rule but to the program rules of the entire program.

P.S Program rules of other programs are running perfectly fine.

Thanks!

Hello,
I had the same issue and found that the root cause was program rule variables (PRVs) with no object linked to them. In my case, it was a PRV with no data element, but it will also happen if there is a PRV with no attribute. I was able to find the specific PRV by running “Data Integrity Checks” under the “Data Administration” module.
Hope that helps.