diff --git a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java index e2d144f17..cccffb850 100644 --- a/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java +++ b/src/main/java/org/sunbird/org/service/ExtendedOrgServiceImpl.java @@ -320,7 +320,9 @@ private String findRootOrgId(String orgName, String mapId) { // We are going to search only 3 times for (int i = 0; i < 3; i++) { Map searchRequest = new HashMap(); - searchRequest.put(Constants.ORG_NAME, orgName); + if (StringUtils.isNotEmpty(orgName)) { + searchRequest.put(Constants.ORG_NAME, orgName); + } searchRequest.put(Constants.MAP_ID, mapId); List> existingDataList = cassandraOperation.getRecordsByProperties( @@ -332,8 +334,8 @@ private String findRootOrgId(String orgName, String mapId) { if (Constants.SPV.equalsIgnoreCase(parentMapId)) { return (String) data.get(Constants.SB_ORG_ID); } else { - mapId = (String) data.get(Constants.MAP_ID); - orgName = (String) data.get(Constants.ORG_NAME); + mapId = (String) data.get(Constants.PARENT_MAP_ID); + orgName = StringUtils.EMPTY; continue; } } else {