Null Pointer with Leaver Trigger Rule

Which IIQ version are you inquiring about?

Version 8.4

Share all details related to your problem, including any error messages you may have received.

IIQ 8.4

We recently started using an ‘Immediate Termination’ Quicklink Workflow for special cases. All other terminations ustilize the standard framework Leaver workflow. When we use the Immediate Termination it works fine except upon next HR aggregation and Identity Refresh the already terminated Identity is seen to have the ‘Record Status’ from HR changed and it triggers the Termination workflow. As part of the termination workflow, we set ‘IIQLifecycleStatus’ to ‘TerminationProcessed’. I’m trying to add into the trigger code that if ‘IIQLifecycleStatus’ equals ‘TerminationProcessed’ then return false and don’t run the Leaver Workflow again.

I’m getting a nullPointer error when an Identity is refreshed and their ‘IIQLifecycleStatus’ is Empty/NULL.

I was hoping someone could assist in pointing out where I’m going wrong?

public static boolean isLeaverCustomTriggerRule(SailPointContext context, Identity previousIdentity, Identity newIdentity){

boolean flag = false;
	
String prevStatus = null;
String newStatus = null;
String prevIIQLifeCycle = null;

if( null != previousIdentity) {
  prevStatus = previousIdentity.getStringAttribute("recordStatus");
  prevIIQLifeCycle = previousIdentity.getStringAttribute("IIQLifecycleStatus");
}

if( null != newIdentity) {
  newStatus = newIdentity.getStringAttribute("recordStatus");
}
	
if((null!=prevStatus && null!=prevIIQLifeCycle) && (prevStatus.equalsIgnoreCase("Terminated") || prevStatus.equalsIgnoreCase("Rejected") || prevIIQLifeCycle.equalsIgnoreCase("TerminationProcessed"))) {
		llogger.debug("Identity is already terminated");
		flag = false;			
	}
	else if(null!=newStatus && (newStatus.equalsIgnoreCase("Terminated") || newStatus.equalsIgnoreCase("Rejected"))){
		llogger.debug("Triggering SP LCE Leaver WF for "+newIdentity.getName());
		flag=true;
	}
			return flag;
}

@chrisk

Tested your method with rule, i don’t see any Null pointer. May be you have some other place where the nullpointer should be. You can put some more logs.

Try One more thing, In trigger rule before call of isTriggerLeaverRule(context, previousIdentity, newIdentity), put some logs to see previousIdentity and newIdentity. sometimes it returns void. So that that case you need to handle before calling isTriggerLeaverRule.

Try below to use StringUtils API, it will look more cleaner.

``

import org.apache.commons.lang3.StringUtils;

public static boolean isLeaverCustomTriggerRule(SailPointContext context, Identity previousIdentity, Identity newIdentity) {

boolean flag = false;

String prevStatus = null;
String newStatus = null;
String prevIIQLifeCycle = null;
String IdName = null;

if(null != previousIdentity) {
prevStatus = previousIdentity.getStringAttribute(“recordStatus”);
prevIIQLifeCycle = previousIdentity.getStringAttribute(“IIQLifecycleStatus”);
}

if(null != newIdentity) {
newStatus = newIdentity.getStringAttribute(“recordStatus”);
IdName = newIdentity.getName();
}

if (StringUtils.equalsIgnoreCase(prevStatus, “Terminated”) || StringUtils.equalsIgnoreCase(prevStatus, “Rejected”) || StringUtils.equalsIgnoreCase(prevIIQLifeCycle, “TerminationProcessed”)) {
llogger.debug(“Identity is already terminated”);
flag = false;
}else if(StringUtils.equalsIgnoreCase(newStatus, “Terminated”) || StringUtils.equalsIgnoreCase(prevStatus, “Rejected”)) {
llogger.debug("Triggering SP LCE Leaver WF for "+IdName);
flag=true;
}
return flag;
}

``

2 Likes

@chrisk

Maybe the Null Pointer issue is from some other event, you may try this

  1. Disable Lever event
  2. Run the refresh task for the same identity.
    if you still face the issue, then it might be from other event rule.
1 Like

Thanks for the replies and the help! Worked for hours with constant errors and think it ended up being some malfomed quotes. Once I change them all it works find now.

Thanks again.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.