Iterating over a list of Account Request within for loop in before provisioning rule

Which IIQ version are you inquiring about?

IIQ 8.3p5

Please share any other relevant files that may be required (for example, logs).

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

sailpoint.tools.GeneralException: The application script threw an exception: java.lang.ClassCastException: Cannot cast sailpoint.object.ProvisioningPlan$AccountRequest to sailpoint.object.ProvisioningPlan$AccountRequest BSF info: LU Rule SAP Analytics Before Provisioning at line: 0 column: columnNo

hi @sn036

It looks like the issue might be due to a classloader conflict or an incorrect type assumption.

Ensure that plan.getAccountRequests() is actually returning a list of AccountRequest objects and not a generic Object or a different subclass.

Instead of this:
List accountRequests = (List) plan.getAccountRequests();

Try using this safer approach:

List accountRequests = plan.getAccountRequests();
for (Object obj : accountRequests) {
if (obj instanceof AccountRequest) {
AccountRequest acctReq = (AccountRequest) obj;
// proceed with logic
}
}

Hi @haideralishaik

Thanks for your response!!

I did check the object type and it is ProvisioningPlan.AccountRequest. As I mentioned above this issue is evident with 8.3p5 and we were not facing the issue in 8.3p4 with same code.

Hi Team,

Anyone else facing the similar issue?

Thanks
Selvaraj N

Hi @sn036

I don’t see an issue in your code. However, the BeanShell executor can sometimes behave unpredictably with type declarations. So I would recomment to use List accountRequests = null; instead of List<AccountRequest> accountRequests = null;

Hi Arpitha,

Thanks for your response!

I tried the way you mentioned as well before, but even that didn’t work with IIQ 8.3p5. I was able to fix the issue by assigning the list of account requests to Object instead of AccountRequest class in FOR loop.

for (Object obj : accountRequests) {
//DON’T PERFORM AN EXPLICIT CASTING
String nativeIdentity = obj.getNativeIdentity();
}

Without performing an explicit casting I was able to run the rule without any issue. This does not only apply for Account Request object, it applies for all the SailPoint Classes. I observed casting error for Application, Attributes and so on. So, for every Sailpoint object, I did assign it to an generic Object class variable.

Thanks

1 Like