diff --git a/generics/services/form.js b/generics/services/form.js index c24fe9df..c7d281aa 100644 --- a/generics/services/form.js +++ b/generics/services/form.js @@ -34,10 +34,16 @@ const configForStateLocation = function ( stateLocationCode, entityKey ) { return fieldInstance.code == messageConstants.common.PERSONA })[0].children.administrator; + let allowedLocationFields = ["state", "district", "block", "cluster", "school"]; + //Entity type is stored in a key called code - let subEntities = subEntityData.map( subEntity => { - return subEntity.code; - }) + let subEntities = subEntityData.filter( subEntity => { + if(allowedLocationFields.includes(subEntity.code)){ + return true; + }else { + return false; + } + }).map(subEntity => subEntity.code) //set cache data for given state let setCache = cache.setValue(entityKey, subEntities, messageConstants.common.CACHE_TTL); return resolve(subEntities);