Unable to get workitem id for email notifications

Which IIQ version are you inquiring about?

IIQ 8.4

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

Hi all,

I am trying to get print the workitem id or request id in the email which is triggered upon approval of the create identity workflow. However, I am not sure how to retrieve the workitem id as the rule does not have the workitem object. Please advise.

From my understanding the LCM Create and Update workflow will call LCM Requester Notification email template.

image

In LCM Requester Notification there is not WorkItem object.

How can I proceed with this?

Hi Shi Jing Wong,

Please fetch the approvalSet object, you will get information of all the requested items.

List listOfApprovalItems=approvalSet.getItems();
		for(ApprovalItem approvalItem : listOfApprovalItems)
		{
			
			String requestId=approvalItem.getId();
                         //further customization
			
		}

Hi @Vinodcsod, this will print a random string. That is not the work item id I am trying to retrieve.
image

can you try to add the below argument in you email template.

  <Argument name="item" type="WorkItem">

// and use ${workItem.id} in your email body get the workitem id
or
//you can directly get the id of the work item using reference as item in your approval step

item.getId();
item.getIdentityRequestId()

Hi @shijingg,

The flow starts with the workflow LCM Create and Update and then calls Identity Request Notify. The identityRequestId is created in LCM Create and Update but isn’t passed into Identity Request Notify as a variable but it is in the plan variable.

I modified the Identity Request Notify workflow and edited the Notify User step to add the arg identityRequestId:

  <Step action="call:sendEmail" condition="script:Util.csvToList(notificationScheme).contains(&quot;user&quot;)" icon="Email" name="Notify User" posX="98" posY="10">
    <Arg name="template" value="ref:userEmailTemplate"/>
    <Arg name="identityRequestId" value='script: return plan.getArguments().getMap().get("identityRequestId");'/>
    <Arg name="to" value="script:getUserEmail(identityName, plan)"/>
    <Arg name="approvalSet" value="call:prepareApprovalSetForNotification"/>
    <Transition to="Notify Requester"/>
  </Step>

Then in your email template LCM User Notification you can add $identityRequestId wherever you want.

I hope that was what you were looking for.

1 Like

Just a heads up, signature tags in email templates are essentially just a comment block. They are nice to have to know what’s supposed to be in context but aren’t required to reference a passed in variable.

Where I do find them being required are in objects like Workflow (passing variables from one workflow to another) and TaskDefinition (rendering task result statistics).