Complete task from Script task Listener
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2014 06:57 AM
is it possible in activiti something like this to complete task
<userTask id="usertask1" name="All your base are belong to us">
<extensionElements>
<activiti:taskListener event="assignment" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
delegateTask.getExecution().getEngineServices().getTaskService().complete(delegateTask.getId());
</activiti:string>
</activiti:field>
<activiti:field name="language" stringValue="groovy" />
<activiti:field name="resultVariable" stringValue="myVar" />
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="usertask1" name="All your base are belong to us">
<extensionElements>
<activiti:taskListener event="assignment" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
delegateTask.getExecution().getEngineServices().getTaskService().complete(delegateTask.getId());
</activiti:string>
</activiti:field>
<activiti:field name="language" stringValue="groovy" />
<activiti:field name="resultVariable" stringValue="myVar" />
</activiti:taskListener>
</extensionElements>
</userTask>
Labels:
- Labels:
-
Archive
7 REPLIES 7
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2014 06:58 AM
sorry ignore above post ….
is it possible in activiti something like this to complete task …
<code>
<userTask id="usertask1" name="All your base are belong to us">
<extensionElements>
<activiti:taskListener event="assignment" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
delegateTask.getExecution().getEngineServices().getTaskService().complete(delegateTask.getId());
</activiti:string>
</activiti:field>
<activiti:field name="language" stringValue="groovy" />
</activiti:taskListener>
</extensionElements>
</userTask>
</code>
is it possible in activiti something like this to complete task …
<code>
<userTask id="usertask1" name="All your base are belong to us">
<extensionElements>
<activiti:taskListener event="assignment" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
delegateTask.getExecution().getEngineServices().getTaskService().complete(delegateTask.getId());
</activiti:string>
</activiti:field>
<activiti:field name="language" stringValue="groovy" />
</activiti:taskListener>
</extensionElements>
</userTask>
</code>
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2014 04:27 AM
please help
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2014 06:25 PM
anyone know about this
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 03:03 AM
It's not possible to complete the task which is currently being assigned from within a task-listener. This is due to the fact that the task-listener is actualy working on the task you want to see completed. What is your actual use case?
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 06:09 AM
thanks for your reply..
Actually i have created a approval process.
In that approval process there may 5 approvers but more that 50% approval required(means minimum 3 approval required).
So what if the process initiator is one of the approver… thats way i try to complete task within the taskListener .
Actually i have created a approval process.
In that approval process there may 5 approvers but more that 50% approval required(means minimum 3 approval required).
So what if the process initiator is one of the approver… thats way i try to complete task within the taskListener .
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 07:34 AM
Okay, I think you should model this into your process (manager has veto-rights) instead of trying to fix this in a listener. One option is to set a special variable from within a task-complete listener in case the manager has approved. Then, use this variable in your Multi-instance completion condition on the review-task declaration.
![sarkar92 sarkar92](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 08:20 AM
got it….
thanks a lot
thanks a lot
![](/skins/images/A90266AC6EB1934BC937DAFB2842964E/responsive_peak/images/icon_anonymous_message.png)