Dear Community,
Our production (2.30, build: ee4cb99) is facing a strange issue which is preventing users from accessing Event forms in Tracker capture.
We cannot open entry form in Tracker capture anymore. Nor we can open “Assign Data Elements” and “Create Data Entry Form” sections in Program Maintenance. The error is:
Uncaught TypeError: Cannot read property 'domainType' of undefined
at AssignDataElements.js:256
I have a bit of JS background, so here is what I’ve been able to figure out:
The code where error occurs:
/* Fix for DHIS2-4369 where some program stages may contain other dataelements than TRACKER
This is due to a database inconsistency. This fix makes it possible to show and be able to remove these
elements from the UI.
itemStore needs to be a superset of all assigned items, so we add the items that are assigned,
but may not be in prop.trackerDataElements */
const otherElems = props.model.programStageDataElements
.filter(({ dataElement }) => (
dataElement.domainType !== "TRACKER" && !dataElementIds.has(dataElement.id)
))
.map(({ dataElement }) => ({
id: dataElement.id,
text: dataElement.displayName,
value: dataElement.id,
}));
For one of the programStageDataElement
that the code is looping over, there exists one without corresponding dataElement attached to it, and thus “dataElement” becomes undefined.
The offending programStageDataElement
is:
<programStageDataElement lastUpdated="2019-04-28T17:07:55.268" id="dNpwdrfbxji" created="2019-04-28T17:07:55.268">
<displayInReports>false</displayInReports>
<skipSynchronization>false</skipSynchronization>
<externalAccess>false</externalAccess>
<renderOptionsAsRadio>false</renderOptionsAsRadio>
<allowFutureDate>false</allowFutureDate>
<compulsory>false</compulsory>
<allowProvidedElsewhere>false</allowProvidedElsewhere>
<sortOrder>46</sortOrder>
<favorite>false</favorite>
<access>
<read>true</read>
<update>true</update>
<externalize>true</externalize>
<delete>true</delete>
<write>true</write>
<manage>true</manage>
</access>
<programStage id="YECy5jC9Sre"/>
</programStageDataElement>
This DHIS2-4369 is the similar issue we’re facing. One of the comment said that it worked after deleting the offending programStageDataElement
. So, we deleted that programStageDataElement
.
It opened once or twice after that, and we had to reassign some data elements again. Then, after saving, a new programStageDataElement
without dataElement
is created again. Deleting it again deletes lots of other programStageDataElements
. Tried reassigning again, and after save, the problem occured again.
Our users have been unable to enter lab results since today. Please let me know if I can provide any more information. We recently upgraded the WAR file to this build (ee4cb99), and it seems to have fixed our previous memory leak issue.