Error when editing Person profile in Capture app

When I click the Edit button for an enrolled user in the Capture app as shown in the image below, I got the following error message.

cadre

I get the following technical error on the page

TypeError: Cannot read properties of null (reading ‘code’)

Hi @jetisco4u

What version of dhis2 are you using? And could you take a full screenshot of the console?

Maybe steps to reproduce this issue on any of the play.dhis2.org instances will be helpful. :slight_smile:

Thanks!


Also, I think this post is supposed to be in Support - Assistance technique category? Thanks!

I am using 2.39.1.1

In the console I got the following error

Could you make sure that the related TEA has a Code in the configuration? Additionally, check that OUs have Code in them too!

I just make sure all the TEAs have code. And also all the OUs have code in them. Clear the cache and attempt to open the page again. Same errors still stay from the console. But I didn’t see the error in the Catalina log.

@Gassim I noticed that this problem is not showing for the old dashboard but I am only seeing it in the new dashboard.

I compare the fields from the trackedEntityAttributes API and noticed these differences.

  1. “publicAccess”: “r-------” in mine but not in play.org
  2. “access”: {“externalize”: true} in mine but false in play.org
  3. “sharing”: {“public”: “r-------”} in mine but not in play.org
  4. “sortOrderInVisitSchedule”: 0, in play.org but not in mine
  5. “displayInListNoProgram”: false in mine but true on play.org
  6. “favorite”: false in play.org but not on mine

Thanks! Please don’t worry much about the useNewDashboard error (see here.)

However, I think now that we’ve got rid of the "reading ‘code’ " issue, we’ll need to tackle the "reading ‘trackedEntityAttributeId’ "

There’s an issue with the TEAs, and it’s either sharing settings or some changes in the database with the trackedentityattibute table. If you’ve got all sharing settings properly, would you run a sql query and check if an error is returned or if values are returned:
SELECT * FROM trackedentityattribute;

I run this query in the database and it returns the exact number of result I saw in the maintenance app.

Also I query with the api https://siteurl.com/api/trackedEntityAttributes?fields=*
and it returns the json records.

Okay, thanks then this is with ‘view’ - it’s working as expected, and you’re sure that Capture and view are allowed?

Could you test using a POST request to edit the same values using the API and not the capture app?

Do you think no 1 and 3 in this list can cause a sharing issue?

Yes, it’s interesting that you’ve only the read access and not the write authority. This needs to be updated! :+1:

Not for public but for your user. :slight_smile:

Hi @Gassim

Hope you are doing well.
I have faced the same problem

DHIS 40, Capture app v.100.47.3.

I have followed your suggestions and checked all data write permissions. The interesting part is I have 2 programs, it works perfectly fine and runs everything for the one program, and doesn’t work for other one.

Everything gets stuck as soon as I’m trying to add new enrollment.
Do you have any idea or suggestions?

Thank you.

Regards,

Ulanbek

@Gassim ,

I found the source of problem. It seems there is a bug which is connected to the attributes section of the program which was included into program and there are data collected, then later was deleted from the program.

So it seems program code scanning not an actual programStage section. Please inform developers to fix this bug.

In my case I had 2 sections, I have deleted both and now I have no problems.

Thank you.

1 Like