Skip to Content

SCP Workflow - Task not found

Hi,

I am currently exploring the Workflow service APIs and I am testing the same using Postman. I have been trying to update the context of a particular task as shown below:

Request details:

URL: {{workflowservice}}/v1/task-instances/{{taskInstanceId}}

Method: Patch

Header: Authorization / bearer token value

Body:

{
"context": {},
"status": "COMPLETED",
"subject": "Pending at processor",
"description": "Pending at processor",
"recipientUsers": "test",
"recipientGroups": "test",
"processor": "test",
"dueDate": "2018-04-02T07:17:44.004Z",
"priority": "VERY_HIGH"
}

I am getting a 404 response code stating: bpm.workflowruntime.task.not.found. It means to say that the given "taskInstanceId" cannot be found.

However when I try to "GET" the task instance context using the same ID it returns the data successfully i.e:

{{workflowservice}}/v1/task-instances/{taskInstanceId}/context

What could be the issue here?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Apr 04 at 12:00 PM

    Hi Kavya,

    my suspicion is that the placeholder {{taskInstanceId}} is not resolved correctly.
    Can you try to use the task instance ID instead of the placeholder in the request URL?

    Regards,
    Waldemar

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 04 at 12:54 PM

    Hi Waldemar,

    I did try it using the Task Instance ID directly, but it didn't work. I also simply replaced the POST method with the GET method to check whether there was any ID related issue. But GET works perfectly fine, whereas the same details fail in the POST request.

    Regards,

    Kavya

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 13 at 07:36 AM

    Hello Kavya

    I have recently used this in my blog via PHP the API to udpate task. One is before updating anything you need to fetch XSRF token secondly use that with the PATCH method.

    Thanks

    Nabheet

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Nabheet,

      Thanks for your reply.

      I am currently using OAuth authorization to access the workflow APIs. I was trying to access the CSRF token earlier but when I wasn't getting the appropriate token in response header I raised an SAP support ticket.

      This is the reply I received in the support ticket:

      "with OAuth authorization, CSRF token is not needed."

      When I received this information in the support ticket, I tried the workflow creation / initiation call (POST) without passing the CSRF token header, and it worked just fine

      Now however when I try to use the "PATCH" method, I get the "bpm.workflowruntime.task.not.found" response.

      I wonder where I am going wrong. Could you help please?

  • avatar image
    Former Member
    Apr 17 at 04:12 AM

    Hi,

    I'm also facing the same issue. Below is the screenshot where I'm able to fetch all workflow instances.

    But when I tried to change the status of the task through API call. I'm getting error code 404. Below is the screenshot of the error. Can anyone please help me here?

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 17 at 12:31 PM

    Dear Satish,


    for me it looks like you are using the Workflow instance ID (from your first call) as the Task ID in your second call.

    This should be the reason for your issue, as the Task ID is another one.

    One possibility in your case is to use the workflow-service/rest/v1/task-instances?workflowInstanceId= API for retrieving the task ID(s) of a workflow instance.

    Regards,

    Michael

    Add comment
    10|10000 characters needed characters exceeded