Getting undefined variable accountRequest in fieldvalue rule

Which IIQ version are you inquiring about?

Version 8.3

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

Hi All,

we have a requirement where we need custamized values in provisioning form field based on the request type(ondemand request or birthright provisioning). It is giving undefined variable accountRequest and project error. However both arguments are present in the FieldValue type rule.

Anyone knows the cause behind this and help to resolve the issue.

Thanks in Advance!

Below is the code snippet for field value rule:

import sailpoint.object.Link;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.Custom;
import sailpoint.object.Filter;
import sailpoint.tools.GeneralException;
import sailpoint.tools.Util;
import sailpoint.api.SailPointContext;
import org.apache.commons.logging.Log;
import sailpoint.*;
 
  
 
 log.error("project: " + project.toXml());
log.error("AccountRequest: " + accountRequest.toXml());
  
String sourceName = "";
List attributeRequest = accountRequest.getAttributeRequests();
  
 
for (AttributeRequest attrReq : attributeRequest){
 
String attrName = attrReq.getName();
if(attrName.equalsIgnoreCase("source")) {
 
sourceName = (String) attrReq.getValue();
log.error("sourcename: " + sourceName);
}
}
 
if(sourceName.equals("Identity Refresh"))
return (postOfficeBox + "@assignment");
else 
return (postOfficeBox + "@request");

I think that the problem is that sometimes in fieldValue rule provisioning project can be null that’s why you are getting undefined variable error.

I would suggest to move your code to before provisioning rule where you ALWAYS have provisioning plan available and you can just inspect the plan to add needed suffix to the attribute request right before it goes to the connector.

It would be actualy fairly simple change in your code

import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;


String attributeName = "postOfficeBox";

List accountRequests = plan.getAccountRequests();
for(AccountRequest accountRequest : accountRequests) {

String sourceName = plan.getSource();
AttributeRequest attributeRequest = accountRequest.getAttributeRequest(attributeName);
String attributeValue = attributeRequest.getValue();

if(sourceName.equals("LCM"))
attributeRequest.setValue(attributeValue+ "@request");
else 
attributeRequest.setValue(attributeValue+ "@assignment");
}

It would be something like that

Thanks for you reply.
For request based provisioning, I have to take input from user whereas for birthright role I have to populate value based on some logic. Hence I cant use before provisioning rule. As I have to put review required as false for birthright provisioning and keep it true for request based. So has to manage it on form leverl.

@kjakubiak is there any way we can get plan in FieldValue rule so from plan we can get source?

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