cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while setting build process workflow user task to "COMPLETED" using API Call

0 Kudos
1,382

Hello Expert,

i have created a workflow on SAP Build which has 2 step approval process.

These 2 steps are designed using approval form which has "Approve" and "Reject" branch as shown in the screenshot.

i am able to call the API to get the task Details and now i want to mark first user task as Completed.

hence i am calling API :

/v1/task-instances/{taskInstanceId}

With following context:

{<br>   "context": {},<br>   "status": "COMPLETED",<br>   "decision": "",<br>   "subject": "",<br>   "description": "",<br>   "recipientUsers": "",<br>   "recipientGroups": "",<br>   "processor": "",<br>   "dueDate": "2023-09-19T08:14:52.691Z",<br>   "priority": "VERY_HIGH",<br>   "confidenceLevel": 0<br>}

But it returns with error saying :

{<br>  "error": {<br>    "message": "No outgoing sequence flow of element 'form_firstlevelapprovaluw_1' could be selected for continuing the process",<br>    "logId": "eb60dd13-50b0-4c5f-a4c2-cb93dcc-eu10"<br>  }<br>}

Note: Setting status "Approve" or "Reject" doesnt work as it throws message saying invalid status. so i guess "COMPLETED" is the way to go. but not sure what branch and sequence flow it needs.

Thanks in advance for your time.

Accepted Solutions (1)

Accepted Solutions (1)

tobias_breyer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

please refer to the API documentation: https://api.sap.com/api/SPA_Workflow_Runtime/path/patch_v1_task_instances__taskInstanceId_

I think the empty decision value you provide causes the issue. See the specific description in the API documentation:


Specify the decision taken by the user when the task status is set to 'COMPLETED'.
The decision can be evaluated with a respective expression to adapt the control flow accordingly.

Regards,

Tobias

0 Kudos

So turn out my issue was, i was passing decision="Approve" / "APPROVE"

it doesnt recognize it.

for future , if anyone has this issue just pass decision="approve" it somehow only recognize small caps

Answers (1)

Answers (1)

0 Kudos

Hi Tobias,

thanks for the reply. I tried to add Decision = "APPROVE" and Status="COMPLETED" while calling the patch API but the error remains the same.

so i thought may be my workflow needs a Decision elements so i added it as follow .

Still no luck and error remain the same saying "No outgoing sequence flow ..."

Note : i did tested my workflow by manual approval in Workflow inbox and it moves to second level approval after i click on Approve on the first task in inbox. Not sure what's missing.

may be i am missing very basic thing. any idea?

luicchi
Newcomer
0 Kudos

Hello, you just have to make a task of approval, and take the id of your task, then you can approve this task with:

luicchi_0-1736502853500.png