Before Provisioning Rule throwing Unknown Error

Hi experts,

I am facing an ‘Unknown Error: Null’ in my Before Provisioning rule. In my rule, I do a null check on the account requests in my provisioning plan before moving on to my business logic, but this line (Line 245) seems to be the reason why i’m facing the error above.

Before Provisioning Rule snippet:
image

Error snippet:
image

Any help would be appreciated, thank you!

@mingsiewang ,

Put one more check in the if condition at line number 245. Like, accountRequests.size()>=1
Then it will work without any issue.

Hi Bhanu,

I’ve a team member that tried that previously but we still obtained this error:
image

Is there any issue with our condition in this case?

Hi @mingsiewang,

You may check line number 222 in the code, there is invalid evaluation error, that means a syntax or execution problem with the code being evaluated.

Thank You.

Hi Bapu,

Line 222 is exactly “if (null != accountRequests && accountRequests.size() >0)”

Hi @mingsiewang ,

Could you share the complete code?
And along with error logs. So that we can check clearly!

Hi Bhanu,

Unfortunately, the complete code actually contains confidential client reference data thus I am unable to share it. However, I am able to share a short pseudo-code:

        List accountRequests = null == plan.getAccountRequests() ? new ArrayList() : plan.getAccountRequests();
        Identity identity = plan.getIdentity();

        if (!accountRequests.isEmpty()) {
            if (op.equals(AccountRequest.Operation.Modify)) {
            if (identity != null) {
                String deptAdidChange = identity.getStringAttribute("deptAdidChange");
                if ((deptAdidChange.equalsIgnoreCase("true"))) {
                        //Create a new account request (with op = Create)
                        AccountRequest newAccReq = accountRequest.clone();
                        newAccReq.setOperation(ProvisioningPlan.AccountRequest.Operation.Create);
                        plan.add(newAccReq);

                        //Modify existing account request (with op = Disable)
                        accountRequest.setOperation(ProvisioningPlan.AccountRequest.Operation.Disable);
                    }
                }
            } else {
                //Logic for other business flows
            }
        }

Our business requirement requires us to disable the current account request & add on a new account request (for account creation) and that is the portion where we are facing the error. We got SailPoint team to help extract our logs but it doesn’t give us much info either. Snippet of the logs:

Hi @mingsiewang

Please change the sentence in line 1 to the sentence in line 2 and let me know the result.

Additionally, I noticed that the error log contains null. I recommend reviewing the source code that uses null inputs.

Regards,

Hi @mingsiewang ,

By any chance, if the accountRequests value becomes null, then there is no way to check the null. So, it is better to check the null first and then use methods on the object reference.

Use below code once:

List accountRequests = plan.getAccountRequests();
Identity identity = plan.getIdentity();

if(null != accountRequests)
{
if (!accountRequests.isEmpty() && accountRequests.size()>=1) {
if (op.equals(AccountRequest.Operation.Modify)) {
if (identity != null) {
String deptAdidChange = identity.getStringAttribute(“deptAdidChange”);
if ((deptAdidChange.equalsIgnoreCase(“true”))) {
//Create a new account request (with op = Create)
AccountRequest newAccReq = accountRequest.clone();
newAccReq.setOperation(ProvisioningPlan.AccountRequest.Operation.Create);
plan.add(newAccReq);

        //Modify existing account request (with op = Disable)
        accountRequest.setOperation(ProvisioningPlan.AccountRequest.Operation.Disable);
      }
    }
  } else {
    //Logic for other business flows
  }
}

}

I hope you are doing null check on plan before that.

Hi Jaewon,

Just wondering, for line 2 - if I were to put ‘plan.getAccountRequests()’ without the ‘null ==’ at the front, it wouldn’t return me a boolean, and the entire line will be erroneous wouldn’t it?

Hi Bhanu, I’m actually doing the null check of the account request at the top, in this line:

   List accountRequests = null == plan.getAccountRequests() ? new ArrayList() : plan.getAccountRequests();

But no, I’m currently not checking if plan is null, let me add that in to try.

Hi @mingsiewang ,

Could you perhaps also share your imports made for this Rule.

Thanks,

Sure Dylan, here you go:
image

Hi @mingsiewang ,

To confirm, did you attempt to check if the ProvisioningPlan is null before the execution of the code?

Another point to mention would be to add loggers in the code and print out some of the values in the rule to check what/where the error is originating from.
I would suggest to almost add the loggers after every line, printing out the variables are results to get a clear understanding of where it stops.

I hope this helps,

Hi all,

We have managed to resolve this error. The issue was with adding the account request directly to the plan in this line of code

plan.add(newAccReq);

Instead of this, we added the new account request to a new list that we created, and then went on to add the current account request to this list. From there, we set the list in our plan and the logic managed to work for a mover flow. The updated code is as follows:

List newAccountRequestList = new ArrayList();
newAccountRequestList.add(newAccReq);
.
.
.
plan.setAccountRequests(newAccountRequestList);
1 Like

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