Unknown error: null JDBC Before Provisioning Rule

Which IIQ version are you inquiring about?

Version 8.0

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

Hi All,

I am trying to write an before provisioning rule for a JDBC application. The basic requirement is that if a plan contains same attribute request with different value it will modify the pan to have only one attribute request for that filed and in the value for that attribute request it will set all the values as list. Below is my code:

import sailpoint.object.Identity;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan.Operation;
import sailpoint.tools.Util;


List values = new ArrayList();
List attReqList = new ArrayList();
int count=0;

// if(plan!=null){
AccountRequest accReq=plan.getAccountRequest("JDBC-Application");

attReqList = accReq.getAttributeRequests();

for(AttributeRequest att: attReqList){

if(att.getName().equalsIgnoreCase("RoleName")){
values.add(att.getValue());
}
}

log.error(values.size());
if(values.size()>1){

for(AttributeRequest att: attReqList){

if(att.getName().equalsIgnoreCase("RoleName")){

if(count==0){
att.setValue(values);
count ++;
} else{
accReq.remove(att);
log.error("need to do");
}
}
}
}
// }

However, this code when ever I am trying to execute it is giving me an unknown error "Caused by: org.apache.bsf.BSFException: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: import sailpoint.object.Identity; import sailpoint.object.ProvisioningPlan; . . . '' unknown error: null : at Line: 26 : in file: inline evaluation of: import sailpoint.object.Identity; import sailpoint.object.ProvisioningPlan; . . . ‘’ : if ( values .size ( ) > 1 ) { "

Can anyone please help me to debug this?

I believe plan.getAccountRequest(appName) is no longer to be used, it is deprecated

Use List accReqs=plan.getAccountRequests(appname);

Iterate this and have the operation check for create or whatever you want to check and proceed with the above and try

Also try adding null checks in the code as below, I am sure if its a null pointer error would be different but always better to have null checks

Hi @Samrat275,

Please try out the changed code. As pointed out you are using the deprecated version of the method.

List values = new ArrayList();
		int count=0;

		// if(plan!=null){
		List accReqList=plan.getAccountRequests("JDBC-Application");
		if(accReqList!=null)
		{
			for(AccountRequest accReq:accReqList)
			{
				List attReqList= accReq.getAttributeRequests();

				for(AttributeRequest att: attReqList){

					if(att.getName().equalsIgnoreCase("RoleName")){
						values.add(att.getValue());
					}
				}

				log.error(values.size());
				if(values.size()>1){

					for(AttributeRequest att: attReqList){

						if(att.getName().equalsIgnoreCase("RoleName")){

							if(count==0){
								att.setValue(values);
								count ++;
							} else{
								accReq.remove(att);
								log.error("need to do");
							}
						}
					}
				}
			}
		}

		// }

Also please make sure you are getting the details after below line.

List<AccountRequest> accReqList=plan.getAccountRequests("JDBC-Application");

Let me know if still you are facing issue.

Thanks

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