{
String orgDN = BSF.getOrganization();
String orgUserDN = "cn="+UserName+",cn=organizational users,"+orgDN;
String queryText = "SELECT CALLID,SOLUTIONID FROM CALLSOLUTIONS WHERE TENANTID=:TENANTID AND CALLID IN (SELECT CALLID FROM CALLS WHERE CONTACT=:CONTACT AND TENANTID=:TENANTID)";
QueryObject query = new QueryObject(queryText);
query.addParameter("TENANTID", "CALLSOLUTIONS.TENANTID",QueryObject.PARAM_STRING, orgDN);
query.addParameter("CONTACT", "CALLS.CONTACT",QueryObject.PARAM_STRING, orgUserDN);
query.setResultClass(CALLSOLUTIONS.class);
BusObjectIterator<BusObject> busObjectIterator = query.getObjects();
deleteIterator(busObjectIterator);
queryText = "SELECT CALLID FROM CALLS WHERE CONTACT=:CONTACT AND TENANTID=:TENANTID";
query = new QueryObject(queryText);
query.addParameter("TENANTID", "CALLS.TENANTID",QueryObject.PARAM_STRING, orgDN);
query.addParameter("CONTACT", "CALLS.CONTACT",QueryObject.PARAM_STRING, orgUserDN);
query.setResultClass(CALLS.class);
busObjectIterator = query.getObjects();
deleteIterator(busObjectIterator);
}