Form Approval on Joiner

Which IIQ version are you inquiring about?

8.3

Please share any images or screenshots, if relevant.

I have a joiner workflow requirement that the manager should approve the new employee before creating the Active Directory Account.

I have a validation script that checks which button has been clicked and proceeds with setting identity attributes.

Now when I click the button it fails:

Workflow:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Workflow PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Workflow created="1728885719070" explicitTransitions="true" id="c0a88183928915608192899e801d0016" libraries="Identity" modified="1729331737432" name="Lifecycle Event - Joiner - SAMREF" type="IdentityLifecycle">
  <Variable input="true" name="trigger">
    <Description>The IdentityTrigger</Description>
  </Variable>
  <Variable input="true" name="event" transient="true">
    <Description>The IdentityChangeEvent.  It can be used to build
      the provisioning plan, but does not need to be
      persisted with the case, so marked as transient.</Description>
  </Variable>
  <Variable input="true" name="identityName">
    <Description>The name of the identity.</Description>
  </Variable>
  <Variable initializer="rule:Joiner - First Name" name="lastName">
    <Description>returns the Last Name of the user.</Description>
  </Variable>
  <Variable initializer="rule:Joiner First Name" name="firstName">
    <Description>returns the First Name of the user.</Description>
  </Variable>
  <Variable initializer="rule:Joiner Employee ID" name="EmployeeID"/>
  <Variable initializer="rule:Joiner - Job Title" name="jobTitle"/>
  <Variable initializer="rule:Joiner - Department" name="Department"/>
  <Variable initializer="rule:manager" name="manager"/>
  <Description>Process a new employee.</Description>
  <Step icon="Start" name="Start" posX="28" posY="10">
    <Transition to="Process user"/>
  </Step>
  <Step icon="Message" name="Process user" posX="174">
    <Description>Process the user that joined.</Description>
    <Script>
      <Source>
      System.out.println("New user was entered the system: " + event.getObject().getDisplayableName());
      </Source>
    </Script>
    <Transition to="Approve Employee"/>
  </Step>
  <Step icon="Approval" name="Approve Employee" posX="381" posY="14">
    <Approval name="Manager Employee Aprroval" owner="ref:manager" return="" send="firstName,lastName,EmployeeID,jobTitle,Department">
      <Form name="Manager Employee Aprroval">
        <Attributes>
          <Map>
            <entry key="hideIncompleteFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="includeHiddenFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="pageTitle" value="Manager Employee Aprroval"/>
          </Map>
        </Attributes>
        <Section>
          <Field displayName="First Name" name="firstName" type="string">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
          </Field>
          <Field displayName="Last Name" name="lastName" type="string">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
          </Field>
          <Field displayName="Department" name="department" type="string">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
          </Field>
          <Field displayName="Job Title" name="jobTitle" type="string">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
          </Field>
          <Field displayName="Employee ID" name="EmployeeID" type="string">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
            <ValidationScript>
              <Source>import sailpoint.object.Form.Button;
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Button clickedButton = form.getClickedButton();
String buttonLabel = clickedButton.getLabel();

// Log initialization for debugging
Log serilog = LogFactory.getLog("sailpoint.Joiner.ButtonAction");
serilog.debug("Button clicked: " + buttonLabel);

Calendar calendar = Calendar.getInstance();

if (buttonLabel.equals("Approve")) {
    identity.setAttribute("reviewed", "Yes");
    identity.setAttribute("nextReviewDate", null);
    serilog.debug("Action: Approve, Reviewed set to Yes, nextReviewDate cleared");
} else if (buttonLabel.equals("Reject")) {
    // Add one day to the current date and set the time to 12:00 AM
    calendar.add(Calendar.DAY_OF_YEAR, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);

    Date nextDayMidnight = calendar.getTime();

    // Format the date to "dd-MM-yyyy HH:mm:ss"
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
    String formattedDate = dateFormat.format(nextDayMidnight);

    identity.setAttribute("reviewed", "No");
    identity.setAttribute("nextReviewDate", formattedDate);
    serilog.debug("Action: Reject, Reviewed set to No, nextReviewDate set to: " + formattedDate);
}

return null;</Source>
            </ValidationScript>
          </Field>
        </Section>
        <Button action="next" label="Approve"/>
        <Button action="back" label="Reject"/>
      </Form>
    </Approval>
    <Description>Approve the Employee</Description>
    <Transition to="Stop"/>
  </Step>
  <Step icon="Stop" name="Stop" posX="559" posY="59"/>
</Workflow>

Error:

2024-10-19T11:59:37,836 ERROR http-nio-80-exec-4 rest.ui.jaxrs.GeneralExceptionMapper:29 - Uncaught JAX-RS exception.
sailpoint.tools.GeneralException: The application script threw an exception: java.lang.NullPointerException: Null Pointer in Method Invocation BSF info: script at line: 0 column: columnNo
	at sailpoint.server.BSFRuleRunner.runScript(BSFRuleRunner.java:349) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.server.InternalContext.runScript(InternalContext.java:1296) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.server.InternalContext.runScript(InternalContext.java:1277) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.api.Formicator.doValidationScript(Formicator.java:1947) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.api.Formicator.validate(Formicator.java:1714) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.service.form.renderer.FormRenderer.validate(FormRenderer.java:622) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.web.FormHandler.submit(FormHandler.java:376) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.web.FormHandler.submit(FormHandler.java:332) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.service.form.FormService.next(FormService.java:140) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.service.form.FormService.submit(FormService.java:110) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at sailpoint.rest.ui.form.BaseFormResource.submit(BaseFormResource.java:131) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	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 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:231) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.web.SailPointResponseFilter.doFilter(SailPointResponseFilter.java:76) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.rest.jaxrs.MethodOverrideFilter.doFilter(MethodOverrideFilter.java:90) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.rest.RestCsrfValidationFilter.doFilter(RestCsrfValidationFilter.java:71) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.rest.AuthenticationFilter.doFilter(AuthenticationFilter.java:109) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.web.SailPointContextRequestFilter.doFilter(SailPointContextRequestFilter.java:61) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.web.SailPointPollingRequestFilter.doFilter(SailPointPollingRequestFilter.java:151) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at sailpoint.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:63) [identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	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:193) [catalina.jar:9.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.30]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [catalina.jar:9.0.30]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.30]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.30]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.30]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.30]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) [catalina.jar:9.0.30]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.30]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.30]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat-coyote.jar:9.0.30]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.30]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) [tomcat-coyote.jar:9.0.30]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) [tomcat-coyote.jar:9.0.30]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.30]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.30]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.apache.bsf.BSFException: The application script threw an exception: java.lang.NullPointerException: Null Pointer in Method Invocation BSF info: script at line: 0 column: columnNo
	at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngine.java:197) ~[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.runScript(BSFRuleRunner.java:347) ~[identityiq.jar:8.3 Build f4b330b4da3-20220427-175259]
	... 83 more

Any Ideas on why the validation script is failing,

Hi @AhmedWaleed,

Validation script will not return the approval decision. Workflow variable “lastApprovalState” will contains the result of approval decision. Based on the decision, transition to next step and update the identity attribute as per your requirement. Please refer the transition based on decision below.

<Transition to="provision" when="script:lastApprovalState.equals(&quot;Finished&quot;)"/>

    <Transition to="Rejected" when="script:lastApprovalState.equals(&quot;Rejected&quot;)"/> 

1 Like

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