cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get taskid from ScriptTask (groovy)

vala4i
Champ in-the-making
Champ in-the-making
I want to call external script using ScriptTask step. External script after finish his job call REST API to complete task like this:
POST http://loginSmiley Tongueass@host/activiti-rest/service/runtime/tasks/23045 body: '{"action":"complete"}'.

So to do it I need to know taskId. How can I get it in ScriptTask using groovy? I tried to call task.getId(), but got an exception in Activiti Explorer.
Thanks a lot for your help.
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I do not understand you question, but I will try to help.
Assumptions:
    * You have 2 process instances (A,B).
    * The process A is in waiting state (activity: UserTask).
    * process B after the start should complete user task from process A
    * process instance id A is input parameter to start the process instance B
Solution:
Create task query from task service and ask for all task for process instance A. Query returns list of tasks for the given process instance with ids.

Regards
Martin