Error while compiling the project

Which IIQ version are you inquiring about?

8.4

I have a workflow that edits a attribute request depending on the form.

the problem is i get an error while trying to compile the new plan.

Is there anything im missing:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule created="1725023989329" id="0ac874909199178e8191a3712e5111fc" language="beanshell" modified="1725095140033" name="Update Project" type="Workflow">
  <Description>A rule used by a Workflow to determine a step action or variable value.

Note that an Attributes map of all variables from the current WorkflowContext, merged with the arguments from the Step, is also passed into the workflow rule.</Description>
  <Signature returnType="Object">
    <Inputs>
      <Argument name="log" type="org.apache.commons.logging.Log">
        <Description>
          The log object associated with the SailPointContext.
        </Description>
      </Argument>
      <Argument name="context" type="sailpoint.api.SailPointContext">
        <Description>
          A sailpoint.api.SailPointContext object that can be used to query the database if necessary.
        </Description>
      </Argument>
      <Argument name="wfcontext">
        <Description>
          The current WorkflowContext.
        </Description>
      </Argument>
      <Argument name="handler">
        <Description>
          The workflow handler associated with the current WorkflowContext.
        </Description>
      </Argument>
      <Argument name="workflow">
        <Description>
          The current Workflow definition.
        </Description>
      </Argument>
      <Argument name="step">
        <Description>
          The current Step.
        </Description>
      </Argument>
      <Argument name="approval">
        <Description>
          The current Approval.
        </Description>
      </Argument>
      <Argument name="item">
        <Description>
          The WorkItem being processed.
        </Description>
      </Argument>
    </Inputs>
    <Returns>
      <Argument name="Object">
        <Description>
          The result of the workflow rule; dependent on the rule itself.
        </Description>
      </Argument>
    </Returns>
  </Signature>
  <Source>import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningProject;
import sailpoint.api.Provisioner;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Log serilog = LogFactory.getLog("sailpoint.AttributeUpdate.WorkflowRule");
serilog.debug("Starting the script.");

try {
    ProvisioningProject project = workflow.get("project");
    String IdNumber = workflow.get("IdNumber");
    String InsertUserId = workflow.get("InsertUserId");

    if (project != null) {
        serilog.debug("ProvisioningProject retrieved.");

        List plans = project.getPlans();
        if (plans != null) {
            int planSize = plans.size();
            if (planSize != 0) {
                serilog.debug("Number of ProvisioningPlans: " + planSize);

                for (ProvisioningPlan plan : plans) {
                    if (plan != null) {
                        serilog.debug("Processing ProvisioningPlan.");

                        List accountRequests = plan.getAccountRequests();
                        if (accountRequests != null) {
                            int accountRequestSize = accountRequests.size();
                            if (accountRequestSize != 0) {
                                serilog.debug("Number of AccountRequests: " + accountRequestSize);

                                for (AccountRequest accountRequest : accountRequests) {
                                    if (accountRequest != null) {
                                        String applicationName = accountRequest.getApplicationName();
                                        serilog.debug("Processing AccountRequest for application: " + applicationName);

                                        List attributeRequests = accountRequest.getAttributeRequests();
                                        if (attributeRequests != null) {
                                            int attributeRequestSize = attributeRequests.size();
                                            if (attributeRequestSize != 0) {
                                                serilog.debug("Number of AttributeRequests: " + attributeRequestSize);

                                                for (AttributeRequest attributeRequest : attributeRequests) {
                                                    if (attributeRequest != null) {
                                                        String attributeName = attributeRequest.getName();
                                                        serilog.debug("Processing AttributeRequest with name: " + attributeName);

                                                        if ("IdNumber".equals(attributeName)) {
                                                            attributeRequest.setValue(IdNumber);
                                                            serilog.debug("Updated 'IdNumber' to: " + IdNumber);
                                                        } else if ("InsertUserId".equals(attributeName)) {
                                                            attributeRequest.setValue(InsertUserId);
                                                            serilog.debug("Updated 'InsertUserId' to: " + InsertUserId);
                                                        }
                                                    } else {
                                                        serilog.warn("Encountered null AttributeRequest in AccountRequest for application: " + applicationName);
                                                    }
                                                }

                                                accountRequest.setAttributeRequests(attributeRequests);
                                                serilog.debug("AttributeRequests updated for AccountRequest in application: " + applicationName);
                                            } else {
                                                serilog.warn("AttributeRequests list is empty for application: " + applicationName);
                                            }
                                        } else {
                                            serilog.warn("AttributeRequests list is null for application: " + applicationName);
                                        }
                                    } else {
                                        serilog.warn("Encountered null AccountRequest in ProvisioningPlan.");
                                    }
                                }

                                plan.setAccountRequests(accountRequests);
                                serilog.debug("AccountRequests updated in ProvisioningPlan.");

                            } else {
                                serilog.warn("AccountRequests list is empty in the ProvisioningPlan.");
                            }
                        } else {
                            serilog.warn("AccountRequests list is null in the ProvisioningPlan.");
                        }
                    } else {
                        serilog.warn("ProvisioningPlan is null.");
                    }
                }
                serilog.debug("Setup Provisioner");
                Provisioner provisioner = new Provisioner(context);
                project = provisioner.compile(plan);
                return project;
            } else {
                serilog.warn("No ProvisioningPlans found in the ProvisioningProject.");
            }
        } else {
            serilog.warn("ProvisioningPlans list is null.");
        }
    } else {
        serilog.warn("ProvisioningProject is null.");
    }
} catch (Exception e) {
    serilog.error("Error in script", e);
}

serilog.debug("Script completed.");</Source>
</Rule>

This is the error im receiving:

2024-08-31T12:07:41,060 ERROR https-jsse-nio-443-exec-6 sailpoint.AttributeUpdate.WorkflowRule:166 - Error in script
sailpoint.tools.GeneralException: Missing identity
	at sailpoint.provisioning.PlanCompiler.compile(PlanCompiler.java:1423) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Provisioner.compile(Provisioner.java:568) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Provisioner.compile(Provisioner.java:587) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at bsh.Reflect.invokeMethod(Reflect.java:166) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.Reflect.invokeObjectMethod(Reflect.java:99) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.Name.invokeMethod(Name.java:858) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHAssignment.eval(BSHAssignment.java:77) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:80) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:46) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHIfStatement.eval(BSHIfStatement.java:48) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:80) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:46) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHIfStatement.eval(BSHIfStatement.java:48) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:80) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:46) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHIfStatement.eval(BSHIfStatement.java:48) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:80) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHBlock.eval(BSHBlock.java:46) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.BSHTryStatement.eval(BSHTryStatement.java:88) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.Interpreter.eval(Interpreter.java:664) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.Interpreter.eval(Interpreter.java:758) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.Interpreter.eval(Interpreter.java:747) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngine.java:186) ~[bsh-2.1.8.jar:2.1.8 2018-10-02 08:36:04]
	at org.apache.bsf.BSFManager$5.run(BSFManager.java:445) ~[bsf.jar:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at org.apache.bsf.BSFManager.eval(BSFManager.java:442) ~[bsf.jar:?]
	at sailpoint.server.BSFRuleRunner.eval(BSFRuleRunner.java:245) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.server.BSFRuleRunner.runRule(BSFRuleRunner.java:216) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.server.InternalContext.runRule(InternalContext.java:1268) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.server.ScriptletEvaluator.doRule(ScriptletEvaluator.java:237) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.server.ScriptletEvaluator.evalSource(ScriptletEvaluator.java:67) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.evalSource(Workflower.java:5932) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advanceStep(Workflower.java:5171) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advance(Workflower.java:4558) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advanceSubcase(Workflower.java:5498) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advanceStep(Workflower.java:5091) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advance(Workflower.java:4558) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advanceSubcase(Workflower.java:5498) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advanceStep(Workflower.java:5091) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.advance(Workflower.java:4558) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.assimilate(Workflower.java:4208) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.handleWorkItem(Workflower.java:7635) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.process(Workflower.java:1856) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.Workflower.process(Workflower.java:1880) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.api.WorkflowSession.advance(WorkflowSession.java:468) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.service.WorkflowSessionService.advance(WorkflowSessionService.java:105) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.service.form.FormService.next(FormService.java:166) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.service.form.FormService.submit(FormService.java:109) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at sailpoint.rest.ui.form.BaseFormResource.submit(BaseFormResource.java:131) ~[identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at jdk.internal.reflect.GeneratedMethodAccessor2973.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) [jersey-common-2.34.jar:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680) [jersey-server-2.34.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394) [jersey-container-servlet-core-2.34.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346) [jersey-container-servlet-core-2.34.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366) [jersey-container-servlet-core-2.34.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319) [jersey-container-servlet-core-2.34.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205) [jersey-container-servlet-core-2.34.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.web.SailPointResponseFilter.doFilter(SailPointResponseFilter.java:76) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.rest.jaxrs.MethodOverrideFilter.doFilter(MethodOverrideFilter.java:90) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.rest.RestCsrfValidationFilter.doFilter(RestCsrfValidationFilter.java:71) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.rest.AuthenticationFilter.doFilter(AuthenticationFilter.java:109) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.web.SailPointContextRequestFilter.doFilter(SailPointContextRequestFilter.java:61) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.web.SailPointPollingRequestFilter.doFilter(SailPointPollingRequestFilter.java:151) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at sailpoint.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:63) [identityiq.jar:8.3p1 Build 482e85d988b-20220829-142216]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.2.20.RELEASE.jar:5.2.20.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.20.RELEASE.jar:5.2.20.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.71]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.71]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) [catalina.jar:9.0.71]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [catalina.jar:9.0.71]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.71]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [catalina.jar:9.0.71]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.71]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687) [catalina.jar:9.0.71]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [catalina.jar:9.0.71]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [catalina.jar:9.0.71]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-coyote.jar:9.0.71]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.71]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) [tomcat-coyote.jar:9.0.71]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784) [tomcat-coyote.jar:9.0.71]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.71]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-util.jar:9.0.71]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-util.jar:9.0.71]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.71]
	at java.lang.Thread.run(Thread.java:834) [?:?]

From my understanding the plan should contain the identity

Hi @AhmedWaleed,

this error means your plan dont have an identity reference.

You can try to set it wiht plan.setNativeIdentity and plan.setIdentity.

In every case, check your plan before and after the change with:

import sailpoint.tools.xml.XMLObjectFactory;

serilog.debug(plan.toXml());

a couple of improvements:
image
you can delete the if in this case, the for goes on until the last element.

and you can change this for, with a direct if:

if (accountRequest.getAttributeRequest("IdNumber").equals(attributeName) != null)

1 Like

Hello @enistri_devo,

I changed and I added the changes and set Identity but still the same error:
Anything I’m missing?
Logs:
sailpoint6.log (51.5 KB)

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule created="1725023989329" id="0ac874909199178e8191a3712e5111fc" language="beanshell" modified="1725095140033" name="Update Project" type="Workflow">
  <Description>A rule used by a Workflow to determine a step action or variable value.

Note that an Attributes map of all variables from the current WorkflowContext, merged with the arguments from the Step, is also passed into the workflow rule.</Description>
  <Signature returnType="Object">
    <Inputs>
      <Argument name="log" type="org.apache.commons.logging.Log">
        <Description>
          The log object associated with the SailPointContext.
        </Description>
      </Argument>
      <Argument name="context" type="sailpoint.api.SailPointContext">
        <Description>
          A sailpoint.api.SailPointContext object that can be used to query the database if necessary.
        </Description>
      </Argument>
      <Argument name="wfcontext">
        <Description>
          The current WorkflowContext.
        </Description>
      </Argument>
      <Argument name="handler">
        <Description>
          The workflow handler associated with the current WorkflowContext.
        </Description>
      </Argument>
      <Argument name="workflow">
        <Description>
          The current Workflow definition.
        </Description>
      </Argument>
      <Argument name="step">
        <Description>
          The current Step.
        </Description>
      </Argument>
      <Argument name="approval">
        <Description>
          The current Approval.
        </Description>
      </Argument>
      <Argument name="item">
        <Description>
          The WorkItem being processed.
        </Description>
      </Argument>
    </Inputs>
    <Returns>
      <Argument name="Object">
        <Description>
          The result of the workflow rule; dependent on the rule itself.
        </Description>
      </Argument>
    </Returns>
  </Signature>
  <Source>import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningProject;
import sailpoint.api.Provisioner;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import sailpoint.tools.xml.XMLObjectFactory;

Log serilog = LogFactory.getLog("sailpoint.AttributeUpdate.WorkflowRule");
serilog.debug("Starting the script.");

try {
    ProvisioningProject project = workflow.get("project");
    String IdNumber = workflow.get("IdNumber");
    String InsertUserId = workflow.get("InsertUserId");
    String identityName = workflow.get("identityName");

    if (project != null) {
        serilog.debug("ProvisioningProject retrieved.");

        List plans = project.getPlans();
        if (plans != null) {
            int planSize = plans.size();
            if (planSize != 0) {
                serilog.debug("Number of ProvisioningPlans: " + planSize);

                for (ProvisioningPlan plan : plans) {
                  serilog.debug("Plan before anything");
                  serilog.debug(plan.toXml());
                    if (plan != null) {
                        serilog.debug("Processing ProvisioningPlan.");

                        List accountRequests = plan.getAccountRequests();
                        if (accountRequests != null) {
                            int accountRequestSize = accountRequests.size();
                            if (accountRequestSize != 0) {
                                serilog.debug("Number of AccountRequests: " + accountRequestSize);

                                for (AccountRequest accountRequest : accountRequests) {
                                    if (accountRequest != null) {
                                        String applicationName = accountRequest.getApplicationName();
                                        serilog.debug("Processing AccountRequest for application: " + applicationName);

                                        List attributeRequests = accountRequest.getAttributeRequests();
                                        if (attributeRequests != null) {
                                            int attributeRequestSize = attributeRequests.size();
                                            if (attributeRequestSize != 0) {
                                                serilog.debug("Number of AttributeRequests: " + attributeRequestSize);

                                                for (AttributeRequest attributeRequest : attributeRequests) {
                                                    if (attributeRequest != null) {
                                                        String attributeName = attributeRequest.getName();
                                                        serilog.debug("Processing AttributeRequest with name: " + attributeName);

                                                        if ("IdNumber".equals(attributeName)) {
                                                            attributeRequest.setValue(IdNumber);
                                                            serilog.debug("Updated 'IdNumber' to: " + IdNumber);
                                                        } else if ("InsertUserId".equals(attributeName)) {
                                                            attributeRequest.setValue(InsertUserId);
                                                            serilog.debug("Updated 'InsertUserId' to: " + InsertUserId);
                                                        }
                                                    } else {
                                                        serilog.warn("Encountered null AttributeRequest in AccountRequest for application: " + applicationName);
                                                    }
                                                }

                                                accountRequest.setAttributeRequests(attributeRequests);
                                                serilog.debug("AttributeRequests updated for AccountRequest in application: " + applicationName);
                                            } else {
                                                serilog.warn("AttributeRequests list is empty for application: " + applicationName);
                                            }
                                        } else {
                                            serilog.warn("AttributeRequests list is null for application: " + applicationName);
                                        }
                                    } else {
                                        serilog.warn("Encountered null AccountRequest in ProvisioningPlan.");
                                    }
                                }

                                plan.setAccountRequests(accountRequests);
                                serilog.debug("AccountRequests updated in ProvisioningPlan.");

                            } else {
                                serilog.warn("AccountRequests list is empty in the ProvisioningPlan.");
                            }
                        } else {
                            serilog.warn("AccountRequests list is null in the ProvisioningPlan.");
                        }
                    } else {
                        serilog.warn("ProvisioningPlan is null.");
                    }

                    serilog.debug("Plan before Provisioner");
                    serilog.debug(plan.toXml());
                    serilog.debug("Identity Name: " + identityName);
                    plan.setNativeIdentity(identityName);
                    serilog.debug("Plan after setting identity");
                    serilog.debug(plan.toXml());
                    Provisioner provisioner = new Provisioner(context);
                    project = provisioner.compile(plan);
                    return project;
                }
                
            } else {
                serilog.warn("No ProvisioningPlans found in the ProvisioningProject.");
            }
        } else {
            serilog.warn("ProvisioningPlans list is null.");
        }
    } else {
        serilog.warn("ProvisioningProject is null.");
    }
} catch (Exception e) {
    serilog.error("Error in script", e);
}

serilog.debug("Script completed.");</Source>
</Rule>

print the plan and check it

Hi @AhmedWaleed ,

It looks like there is a null coming in the code, and you don’t have a null check for the IdNumber. Please check line 115 and 118; you are setting the null value. Nowhere checked for the null before. Please do a null check on IdNumber before setting it attributeRequest.

Also, please do setIdentity to the plan. Make sure setIdentity is expecting identity object not string object.

1 Like

Hi @AhmedWaleed,

The issue is occurring because the identity is not set to the plan. Please use the code provided below to verify.

Update Project.xml (8.6 KB)

Regards,
Arun

1 Like

Hi @AhmedWaleed,

Please update your nativeIdentity and identity in the plan as mentioned by others.

Let us know if the issue is still coming.

Thanks

1 Like

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