Error Occurs When Opening Data Entry Section: Unable to List Organizations

Hello, I’m a beginner in DHIS2, and I encountered an error when trying to open the data entry section. The error is related to the inability to list the organization in the console, and the specific error message is as follows:

“VM317:1 Uncaught SyntaxError: ‘undefined’ is not valid JSON at JSON.parse () at Object.complete (form.js?_rev=aec9de0:371:30) at i (jquery.min.js?_rev=aec9de0:31:28017) at Object.fireWith (jquery.min.js?_rev=aec9de0:31:28783) at A (jquery.min.js?_rev=aec9de0:33:14163) at XMLHttpRequest. (jquery.min.js?_rev=aec9de0:33:16323)”

The error seems to be occurring within the following function:
"
dhis2.de.loadDataSetAssociations = function() {
var def = $.Deferred();

$.ajax({
	url: 'getDataSetAssociations.action',
	dataType: 'json',
	success: function(json) {
		sessionStorage[dhis2.de.cst.dataSetAssociations] = JSON.stringify(json.dataSetAssociations);
	},
	complete: function() {
		console.log(sessionStorage[dhis2.de.cst.dataSetAssociations]);
		var metaData = JSON.parse(sessionStorage[dhis2.de.cst.dataSetAssociations]);
		dhis2.de.dataSetAssociationSets = metaData.dataSetAssociationSets;
		dhis2.de.organisationUnitAssociationSetMap = metaData.organisationUnitAssociationSetMap;
		def.resolve();
	}
});

return def.promise();

};
"
The specific issue lies in the following line of code:

"
var metaData = JSON.parse(sessionStorage[dhis2.de.cst.dataSetAssociations]);
dhis2.de.dataSetAssociationSets = metaData.dataSetAssociationSets;
"

Additionally, the response in the network does not appear as a valid JSON, unlike what is expected based on the demo.

Thank you @Tala_Taim!

Welcome to the community, and sorry for the delay. Please what version of DHIS2 are you using? Would you please share the steps to reproduce the issue on any of the play.dhis2.org instances?

If you can’t reproduce the issue, please use the Data Administration app → Maintenance → clear application cache, reload apps. After that please login to the instance in the browser’s Guest mode (Guest mode is different from incognito, read here for info)

Thanks!

I appreciate your assistance.

I utilized version 2.37.9.1, which I locally installed on a Windows operating system. The installation involved Tomcat 9, PostgreSQL 14, and Java Runtime Environment (JRE) 1.8.

Upon attempting to access the data entry section, I encountered an issue where the organization failed to load. The error message displayed in console was

"VM317:1 Uncaught SyntaxError: ‘undefined’ is not valid JSON at JSON.parse () at Object.complete (form.js?_rev=aec9de0:371:30) at i (jquery.min.js?_rev=aec9de0:31:28017) at Object.fireWith (jquery.min.js?_rev=aec9de0:31:28783) at A (jquery.min.js?_rev=aec9de0:33:14163) at XMLHttpRequest. (jquery.min.js?_rev=aec9de0:33:16323) ".

Experiencing the same problem with version [DHIS2 2.39.1.2]. And I made an upgrade to [DHIS2 2.39.2] but the problem still persist. What could be the problem?

@Gassim Any support on this issue?

1 Like

@Tala_Taim I am not sure if you found a solution yet but it’s Not Rocket Science :sweat_smile:.

In my case, I figured the admin user I was working with did not have any org unit assigned to it after setting up the org units metadata.

Just putting this out here for anyone who experiences this in future that it is surely related to metadata. You may have to check with users, org units, data elements, option sets, etc. Could take sometime to figure out but be rest assured its a metadata issue.

Best,
Clement

2 Likes

You are probably facing this: Data entry app not loading - #18 by jaime.bosque

The solution goes by creating at least one element in these tables:

        identifiableObjectManager.getLastUpdated( DataElement.class ),
        identifiableObjectManager.getLastUpdated( OptionSet.class ),
        identifiableObjectManager.getLastUpdated( Indicator.class ),
        identifiableObjectManager.getLastUpdated( DataSet.class ),
        identifiableObjectManager.getLastUpdated( CategoryCombo.class ),
        identifiableObjectManager.getLastUpdated( Category.class ),
        identifiableObjectManager.getLastUpdated( CategoryOption.class ) ) )

So make sure there is at least, one item in your OptionSet, Indicator, etc, etc

2 Likes