Expand my Community achievements bar.

Workitem instance path in custom participant step

Avatar

Level 2

Hi All,

 

I am working on a use case where I need to form the path of the work item instance path and share it on the email, so that the user can just click on the workitem path and go to the workitem path directly. But I am not able to form the correct path. I tried using the workitem.getId(), but received a temporary path with VolatileNode in it which does not exist in AEM repository. Any leads to correctly get the workinstance path ?

 

 

5 Replies

Avatar

Level 4

Hi @AyushAg3 ,

 

When you try to construct the work item path using workItem.getId(), AEM returns a transient internal identifier that includes VolatileNode, which is not a valid JCR path and does not exist in the repository. This value is only used internally by the workflow engine and cannot be used to generate a clickable link. Instead, to build a valid workflow inbox URL, you should use the workflow instance ID from workItem.getWorkflow().getId() along with the payload path from workItem.getWorkflowData().getPayload(). Using these, you can construct a direct link to the workflow item in AEM’s inbox as follows:

/aem/inbox.html#item=<workflowInstanceId>

 

This resolves correctly in AEM and opens the corresponding workflow item. Optionally, you can also include the payload path in the email to give context to the approver. The key point is that AEM does not expose a persistent JCR path for a work item, so the workflow instance ID must be used instead to reference the item.

 
Thanks & Regards,
Vishal

Avatar

Level 2

Hi @VishalKa5 I tried to form the link as you suggested, but it did not work out. I am looking for the workitem detail page url.

AyushAg3_0-1761197764806.png

 

Avatar

Level 4

Hi @AyushAg3 ,

 

When working with workflows in AEM, the value returned by workItem.getId() cannot be used to build a valid path in the repository. That ID is internal to the workflow engine and does not correspond to any JCR path. If you want to send users a clickable link that opens the Work Item Detail view in Touch UI (not Classic UI), you should not try to construct a path using the work item ID. Instead, AEM provides a dedicated Touch UI route within the inbox that allows navigating directly to a specific workflow item. This route expects two values: the workflow instance ID and the work item ID. These can be retrieved using workItem.getWorkflow().getId() and workItem.getId() respectively.

Using these two values, you can build a direct Touch UI link like this:

String workflowInstanceId = workItem.getWorkflow().getId();
String workItemId = workItem.getId();
String url = "/aem/inbox.html#/details/" + workflowInstanceId + "/" + workItemId;

 

This URL will open the Touch UI Work Item Detail panel—the same view a user sees when they click on a workflow item inside the AEM inbox. You can include this URL in an email notification so that the approver or reviewer can directly open the workflow task without navigating through the inbox. If you also want to give context in the email, you may append the payload path (which is the actual content under review) using:

String payloadPath = workItem.getWorkflowData().getPayload().toString();

 

This approach is the recommended and supported way to navigate to workflow work items in Touch UI, and it avoids legacy Classic UI links like /libs/cq/workflow/content/console.html, which Adobe no longer recommends.

 

Thanks & Regards,

Vishal

Avatar

Community Advisor

Hi @AyushAg3,

workItem.getId() returns a temporary (volatile) node path that doesn’t exist in the JCR. To get the actual work item instance path, you should reference the workflow instance itself rather than the volatile ID.

Here’s how you can form the correct path:

import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowData;
import com.adobe.granite.workflow.exec.WorkflowSession;

public String getWorkItemInstancePath(WorkItem workItem, WorkflowSession wfSession) {
    String workItemPath = "";
    try {
        // Get the workflow instance ID
        String wfInstanceId = workItem.getWorkflow().getId(); 
        // Build the actual instance path under /var/workflow/instances
        workItemPath = "/var/workflow/instances/" + wfInstanceId;

        // Optionally, get the payload (the actual content path related to the workflow)
        WorkflowData wfData = workItem.getWorkflowData();
        if (wfData != null && wfData.getPayload() != null) {
            String payloadPath = wfData.getPayload().toString();
            System.out.println("Payload Path: " + payloadPath);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return workItemPath;
}

You can then include the link in your email like this:

<a href="https://author-host:port/libs/cq/workflow/content/console.html?item=/var/workflow/instances/server0/2025-10-22/modelname_12345">
    Open Work Item
</a> 

 


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 2

Hi @SantoshSai, The solution which you gave is going to classic ui of workflow instance listing page. I am looking the work item detail page from the touch UI.

 

AyushAg3_0-1761197568267.png