My prototyped customization rule:
// === this is for development remove when complete
import sailpoint.connector.ConnectorFactory;
import sailpoint.connector.Connector;
import sailpoint.object.ResourceObject;
import sailpoint.tools.CloseableIterator;
ConnectorFactory cf = new ConnectorFactory();
Connector ac = cf.getConnector(application, null);
// === end of block
import sailpoint.tools.Util;
try{
// Verify no issues with the Application configuration
ac.testConfiguration();
// If this application has a large number of accounts you can decache through the loop and check for edge cases
// If you have one user in mind you can always change this to something like a getObject
CloseableIterator<ResourceObject> ro = ac.iterateObjects("account", null, null);
while(ro.hasNext()){
ResourceObject object = ro.next();
// Lets start by seeing what data we have to work with
log.debug(object.getAttributes());
// This also gives you a chance to check for those pesky edge cases before going live
// if(Util.isNullOrEmpty(object.getAttribute("id")) || Util.isNullOrEmpty(object.getAttribute("username")) || object.getAttribute("username").length() < 3){
// log.error("null value found or username length too short!");
// log.error(object.getAttributes());
// object.setAttribute("id","100");
// }
// Ok that's what we are looking for let's finish this out
// log.debug(object.getAttribute("username").substring(0,3) + object.getAttribute("id"));
// object.setAttribute("id",object.getAttribute("username").substring(0,3) + object.getAttribute("id"));
// log.debug(object.getAttributes());
// This looks great! let's return the object and verify
//return object;
}
} catch (Exception e){
log.error(e);
}