Custom Workflow

Hi Sailors,

I am facing one weird issue with my custom workflow.

I have 5 steps in a custom workflow and at the 5th step I am having a method which refresh’s the users roles and save the status of the step in workflow variable as shown below.

try {
refershRoles(context, identity);//method
workflow.get(“result”).put(“refresh status”, “Success”);
}
catch (Throwable t) {
workflow.get(“result”).put(“refresh status”, “Failed”);
}

→ Method is executing successfully and after that I am getting below issue and terminating the workflow.

An unexpected error occurred: sailpoint.tools.GeneralException: The application script threw an exception: java.lang.NullPointerException BSF info: script at line: 0 column: columnNo

The above issue is coming only in production and working smoothly in DEV& QA instances and I am unable to reproduces and find the RCA.

Can you help us with you suggestions to fix the issue.

Thanks,

Saikiran D

Hello Saikiran,

I have no idea what your method is doing but you are probably using a method on an object that is actually empty (null).

Like:

Identity identity = context.getObjectByName(Identity.class, “identityName”);
String idName = identity.getName();

If it could not find the identity in the first place it will give back a null object. If you execute any method on it like the .getName() however it will throw you a null pointer. Because it cannot get a name from a null object.

You probably forget to null check:

Identity identity = context.getObjectByName(Identity.class, “identityName”);
if(identity != null) {
String idName = identity.getName();
}

Hi ruben_o,

Thanks for your response.
I have tried by adding multiple loggers and able to see the error is coming at send_email method but still unable to understand the root cause of the issue.

try {
refershRoles(context, identity);//method
workflow.get(“result”).put(“refresh status”, “Success”);
}
catch (Throwable t) {
workflow.get(“result”).put(“refresh status”, “Failed”);
}
**send_email(context,workflow);**

→ send_email(context,workflow); method is used to send a mail to the approver of the workitem.
->I have kept a logger (like : entering into method send_email) in send_email before executing the logic but even that is not getting printed in my log file and it getting failed with the below exception.

An unexpected error occurred: sailpoint.tools.GeneralException: The application script threw an exception: java.lang.NullPointerException BSF info: script at line: 0 column: columnNo

So your null pointer is already happening before the send_email method is executed.

What does this method do exactly: refershRoles(context, identity)?
Could it be that it is getting an attribute or something from the identity and trying to calculate some things on this attribute while it is actually not existing thus null? Are you sure the workflow variable is defined as it should be and not returning null?

refershRoles(context, identity) will refresh the birthright roles of the user based on the staffType i obseved the logs no issue with the above method.
I kept the loggers like below :-

try {
log.debug("null check 1");
refershRoles(context, identity);//method
log.debug("null check 2");
workflow.get(“result”).put(“refresh status”, “Success”);
log.debug("null check 3");
}
catch (Throwable t) {
workflow.get(“result”).put(“refresh status”, “Failed”);
}
log.debug("null check 4");
**send_email(context,workflow);**
log.debug("null check 5");

out put
null check 1
null check 2
null check 3
null check 4
then error

void send_email(SailpointContext context,Workflow workflow)
{
log.debug(“Entering into send_email”);
//my logic
log.debug(“Exiting send_email”);
}

in the above method I am getting the workflow variables and send mail to the approver.

but my question is if it is getting errored out in the method then it should print me the entering into send_email logger but even that is not coming in my loggers

Okay, could still be something with the logic in your send_mail method.

What happens when you comment all your logic out except for the loggers and the return? Does it providing the loggers then? If so you should check what it is in your logic what returns this null pointer