legacy-knowledge-base
公開されました Sep. 10, 2025

Workflow Related APIs

written-by

Kartik Singh

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  1. Retrieve all task details associated with a specific user via API.
  2. Retrieve task details filtered by workflow and user via API.
  3. Perform actions such as 'Approve' and 'Reject' on tasks via API.

Environment

  • Liferay DXP 7.4+
  • Quarterly Release
  • 2023.Q3
  • 2023.Q4
  • 2024.Q1
  • 2024.Q2
  • 2024.Q3

Resolution

1) Retrieve all task details associated with a specific user via API.

2) Retrieve task details filtered by workflow and user via API.

    • http://localhost:8080/o/portal-workflow-metrics/v1.0/processes/{processId}/instances

      • assigneeIds = UserID (kindly navigate to Control Panel> User and Organizations> select the user> copy the "UserID")
      • statuses = Pending

      • processId = 12345

        • To find the 'processId,' execute the GET request 'http://localhost:8080/o/portal-workflow-metrics/v1.0/processes/metrics' API. The response body will look something like the following:

{
"actions": {},
"facets": [],
"items": [
{
"instanceCount": 500,
"onTimeInstanceCount": 0,
"overdueInstanceCount": 0,
"process": {
"active": true,
"dateCreated": "2024-11-14T11:09:32Z",
"dateModified": "2024-11-14T11:09:44Z",
"description": "",
"id": 50087,
"title": "Single Workflow",
"title_i18n": {
"en-US": "single workflow"
},
"version": "2.0"
},
"untrackedInstanceCount": 500
}
],
"lastPage": 1,
"page": 1,
"pageSize": 20,
"totalCount": 1
}

In the above response ("id": 50087) is the 'processId' here for the 'Single Workflow' workflow.

3) Perform actions such as 'Approve' and 'Reject' on tasks via API.

    • Use the PATCH request "http://localhost:8080/o/headless-admin-workflow/v1.0/workflow-tasks/change-transition" endpoint from the Headless Admin Workflow API.

      • Enter the 'workflowInstanceId' in the following API endpoint: GET request "http://localhost:8080/o/headless-admin-workflow/v1.0/workflow-instances/{workflowInstanceId}/workflow-tasks"
        After executing this, you will get the 'workflowTaskId'.

      Note: The processId from the Portal Workflow Metrics API is the same value of the workflowInstanceId from the Headless Admin Workflow.

      • Once get the 'workflowTaskId', execute the PATCH request to the following API: "http://localhost:8080/o/headless-admin-workflow/v1.0/workflow-tasks/change-transition"
        With this method, the body only needs to include the following data:
      {
        "comment": "string",
        "transitionName": "approve",
        "workflowTaskId": 12345
      }

       

Additional Information

  1. Retrieve all task details associated with a specific user from the UI.
    • To view the 'Assigned Tasks' through the UI, navigate to "User Profile Menu > My Workflow Tasks > Assigned to Me", where you will be able to see all tasks assigned to you.

  2. Retrieve task details filtered by workflow and user from the UI.
    • In Liferay there is a 'Metric' option under the Workflow section, it shows the table view of all installed workflow processes and shows how many tasks are overdue, how many are on time, and how many are pending in the workflow process for a specific user.
    • Navigate to the Open Application Menu> Application> Workflow> Metrics> 'Select the workflow that you have created'> Select 'Total Pending' option> Select the 'Assignee' in Filter By.

  3. Perform actions such as 'Approve' and 'Reject' on tasks from the UI.
    • To 'Approve' or 'Reject' please navigate to "Open Application Menu> Application> Workflow> Metrics> 'Select the workflow that you have created'> Select 'Total Pending' option> Select the 'Assignee' in Filter By> select the (⋮)> TRANSITION> select 'Approve' or 'Reject'".

 

did-this-article-resolve-your-issue

legacy-knowledge-base