I have process with 2 tasks namely t1 and t2.
I have a case to start a process on clicking the app and redirect it to task details page.
For this I have written code to start the process on click of app now it is started and i want to redirect it to
t1 task details page
in app.view.component.html
```
<adf-apps (appClick)="onAppClickStartProcess($event)"></adf-apps>
```
in app.view.component.ts
```
onAppClickStartProcess(app: AppDefinitionRepresentationModel) {
this.apppid1 = app.id;
this.processService.getProcessDefinitions(this.apppid1).subscribe(
data => {
console.dir(data)
this.apppid = data;
this.exdepId = this.apppid[0].id;
this.processService.startProcess(this.exdepId, "aaa", "", "", [])
.subscribe(
data => {
//at precent redirecting to this route
this.router.navigate(['activiti/apps', app.id || 0, 'tasks']);
//but it should redirect to this route
//this.router.navigate(['activiti/apps', app.id || 0, 'tasks', taskid]);
});
});
}
```
Kindly help me out.
Thanks & Regards
Anita Patil
You will need to do a task query inside "this.processService.startProcess().subscribe()" using the process instance id returned by startProcess(). The task query response will include the task id which you can then use to re-direct to "this.router.navigate(['activiti/apps', app.id || 0, 'tasks', taskid]);"
Hope this helps!
Ciju
Thank you Ciju Joseph It worked for me. I am able to get taskid and redirect to task details page. As you said added the code inside "this.processService.startProcess().subscribe()".
Code:
Great, thanks for posting the working code back
Hi,
I want to do little modification in it before starting the process I should check whether the particular app i clicked which got any task are in running mode. If yes I should redirect to that task details page else I should call the start process logic. To do this I want process instance id of particular app. How can I achieve this case? any idea?
query for tasks using app id as the filter - Task List | Alfresco Documentation !
Hi,
I have checked with task query api it is actually a post api, Is there any get api available for task list?
Regards
Anita Patil
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.