Here is details descriptive steps on how to get task id from SharePoint designer workflow:
The workflow needs to perform some actions in parallel, sort of, and a “HTTP Web Service Action”.
The web service can get the ID of the latest Task by using the following URL
[%Workflow Context:Current Site URL%] /sites/mySite/_api/web/lists/getbytitle('tasks')/items?$top=1&$orderby=Id%20desc
Using this URL in a “Call HTTP web service” to return “ResponseContent”
The next action is get item from dictionary
Get d/results(0) from Variable: ResponseContent (Output to Variable: ResponseContent )
Following with this
Get Id from Variable: ResponseContent (Output to Variable: TaskId )
This can only work if the workflow runs in a parallel block but with a tweak to run slightly after – this ensures the task item is definitely there.
Setting up the call web service can be done in this way
Do the web service setup steps as normal then add a parallel block
Add and configure start task process into it
The following actions will run in parallel: Start a task process with Variable: Region (Task outcome to Variable: Outcome1 )
Then add an If block
If Current Item:ID is greater than 0
This allows a run of actions sequentially (but still in parallel to the task). Without this the next steps would all trigger at the same time.
Add a pause before continuing just to ensure the task IS created
Pause for 0 days, 0 hours, 1 minutes
Then call the web service
Call [URL]... HTTP web service with request (ResponseContent to Variable: ResponseContent |ResponseHeaders to responseHeaders |ResponseStatusCode to Variable: responseCode1 )
Manage the results
Get d/results(0) from Variable: ResponseContent (Output to Variable: ResponseContent ) Get Id from Variable: ResponseContent (Output to Variable: TaskId )
You can then update an item in a list using the newly found TaskId
Reference :
SharePoint Designer 2013 Workflows – How to get Task Process ID