Success message not displaying in Identity creation form completes

Which IIQ version are you inquiring about?

Version 8.2

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

Hi,

We created a quicklink to onboard non-employee . When manager submits the identity creation, we are trying to display a popup message to shown request has been submitted. We used httpsession method But it throws variable declaration error
“Typed variable declaration : Attempt to resolve method: getAttribute() on undefined variable or class name: httpSession”
Can anyone suggest what we are missing.

import javax.faces.application.FacesMessage; import sailpoint.tools.Message;
            log.error("Inside Complete");
    List currentMessages = httpSession.getAttribute("sailpoint.web.PageCodeBase.sessionMessages");
    
    List myMessages = new ArrayList();
  
    ArrayList messages = wfcase.getMessages();
     if (messages != null) {
      Iterator iter = messages.iterator();  
      while (iter.hasNext()) {
        Message next = (Message) iter.next();
    		FacesMessage myMessage = null;
    		if(next.isError()) {
    			myMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, next.toString() , "");
    		}
    		else {
    			myMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, next.toString() , "");
    		}
    		myMessages.add(myMessage);
      }
    } else {
				myMessages.add(new FacesMessage(FacesMessage.SEVERITY_INFO, "Task: TPS user onboarded successfully" , ""));   
    }
    
    httpSession.setAttribute("sailpoint.web.PageCodeBase.sessionMessages", myMessages);
    
    log.error(messages);
  </Source>
</Script>

If the quicklink calls a workflow you could use the below code (provided you have imported LCM Workflow Library)

<Step action="call:addMessage" name="Show Messages">
  <Arg name="message" value="your message"/>
  <Arg name="type" value="Error"/>
  <Transition to="next step"/>
  </Step>

In the value field you could add the your code without explicitly setting the httpsession.

In case you are not using the workflow, please share the use case

I think you did it a bit to complex - you can just add

 <entry key="workflowSuccess" value="Some Message"/>

into your quicklink attributes this will show the green message after the workflow is executed successfully. Or you can set this variable from the workflow if you want a bit more complex value.

@Preethi
Can you please share your quick link

You should have the httpSession Attribute defined in the quicklink as below under attributes

<entry key="httpSession">

        <value>

          <Script>

            <Source>

              import javax.faces.context.FacesContext;

              import javax.servlet.http.HttpSession;

              log.warn("Inside QuickLink");

              FacesContext fc = FacesContext.getCurrentInstance();

              HttpSession session = fc.getExternalContext().getSession(true);

              return session;

            </Source>

          </Script>

        </value>

      </entry>

try out below , add variable httpSession

  <Variable editable="true" input="true" name="httpSession" transient="true">
    <Script>
      <Source>
        import sailpoint.tools.Message;
        import sailpoint.web.WorkflowSessionWebUtil;
        import sailpoint.api.WorkflowSession;
        import javax.faces.context.FacesContext;
        import javax.servlet.http.HttpSession;

        HttpSession session;
        FacesContext fc= FacesContext.getCurrentInstance();
        if(fc!=null){
        session = (HttpSession) fc.getExternalContext().getSession(true);
        }
        return session;
      </Source>
    </Script>
  </Variable>

Use below code to display message

 <Step name="Display Request Submit Message">
    <Arg name="identityModel" value="ref:identityModel"/>
    <Script>
      <Source>
        import org.apache.log4j.Logger;
        import sailpoint.tools.Message;
        import sailpoint.web.WorkflowSessionWebUtil;
        import sailpoint.api.WorkflowSession;

        import javax.faces.context.FacesContext;
        import javax.faces.application.FacesMessage;
        import javax.servlet.http.HttpSession;
        import sailpoint.object.CustomGlobal;
        import org.apache.log4j.Logger;


        Logger log = Logger.getLogger("vishal.workflow.RequestCreationProcess");
        log.debug("Entering Display Request Submit Message");


        if(quickLinkIdentityId != null){

        String message = "Request has been Submitted Successfully";
        String result = "Success";

        try{
        List&lt;Message> wfcaseMsgList = wfcase.getMessages();
        if(httpSession!=null){
        List currentMessages = httpSession.getAttribute("sailpoint.web.PageCodeBase.sessionMessages");
        FacesMessage myMessage = null;
        if(Util.nullSafeEq(result,"Success")){
        myMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, message, "");
        }
        List myMessages = new ArrayList();
        if(wfcaseMsgList!=null){
        for(Message msg : Util.safeIterable(wfcaseMsgList)){
        FacesMessage wfMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg.getMessage(), "");
        myMessages.add(wfMessage);
        }
        }else{
        myMessages.add(myMessage);
        }
        httpSession.setAttribute("sailpoint.web.PageCodeBase.sessionMessages", myMessages);
        }
        }catch(Exception e){
        log.error("Error in step End user message display : error Message:" + e.getMessage());
        }
        }
        log.debug("Exiting Display Request Submit Message");
      </Source>
    </Script>
    <Transition to="stop"

@Preethi,
Is your issue resolved ?