Wednesday 28 October 2015

LDAP data records iteration issue ( exceed limit error)

if getting this error during data records iterations from ldap by using TDI tool So can use this code in TDI for reseting connection then again TDI will continue the connection flow.
this error comes due to only configured exceed limit on LDAP. 

Use in Before initilaize hooks-

if (typeof(cnt) == "undefined") {
        // this is the first time so cnt is undefined. Init to 0.
        cnt = 0;
        // pageSize must be < the sizelimit
        pageSize = 100;
        // get the LDAP Connector interface
        cnctr = thisConnector.getConnector();
        // start by searching all
        cnctr.setParam("ldapSearchFilter","uid=*");
}

Use in After get next hooks -


// append "." to make it > than current value
uid = conn.getString("uid") + ".";
// increment cnt and test it
if (++cnt > pageSize) {
        // reset cnt
        cnt = 0;
        // debug display message (remove if you want)
        task.logmsg("...restart next time for uid >= " + uid);
        // with Startup = On Config Change, this forces re-init
        cnctr.setParam("ldapSearchFilter", "uid>="+uid);
}

No comments:

Post a Comment