PreviousIdentity not null on Creation IdentityTrigger

Hello and good day to all,

I’m trying to create a new rule for an IdentityTrigger so that when there are new names inserted into the CSV file during aggregation, the rule will find them and create a new application link for the user. Unfortunately, I came across an odd circumstance where, even if the identity cube is brand new, the previousIdentity and the newIdentity are both equal when the IdentityTrigger is scanning for newly aggregated accounts. The task results claim it to be created, but the logs show that it doesn’t have a null previousIdentity to set it as newly created.

Am I doing something wrong? Here is my rule.

try {
  if (previousIdentity == null && newIdentity != null) {
    if (log.isTraceEnabled()) {
      log.trace("New HR Identity Found");
      log.trace("identity = " + newIdentity.getDisplayName());
    }
    IdentityService service = new IdentityService(context);
    if (log.isTraceEnabled()) {
      log.trace("Identity Service Created");
    }
    Application application = context.getObjectByName(Application.class, "LDAP");
    if (log.isTraceEnabled()) {
      log.trace("Identity Service Created");
    }
    List links = service.getLinks(newIdentity, application);
    if (links != null) {
      if (links.isEmpty()) {
        if (log.isTraceEnabled()) {
          log.trace("Identity has no existing links for LDAP");
        }
        return true;
      } else {
        if (log.isTraceEnabled()) {
          log.trace("Identity has an existing link in LDAP");
        }
        return false;
      }
    } else {
      if (log.isTraceEnabled()) {
        log.trace("IdentityService returned a null list for LDAP");
      }
      return true;
    }
  } else {
    if (log.isTraceEnabled()) {
      log.trace("No new identity found");
      log.trace("New identity = " + newIdentity.getDisplayName() +"/ Old Identity = " + previousIdentity.getDisplayName());
    }
    return false;
  }
} catch (Exception ex) {
  log.error(ex);
}

@JamesMcClartyEY - This is expected. For newly created identities, previousIdentity and newIdentity object are identical.

I am wondering for Create event why are you trying to look up previous and new identity objects?