04-24-2018 07:24 AM
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
04-24-2018 10:15 AM
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
04-25-2018 01:11 PM
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:
04-25-2018 01:52 PM
Great, thanks for posting the working code back
04-26-2018 03:05 AM
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?
04-26-2018 09:02 AM
query for tasks using app id as the filter - Task List | Alfresco Documentation !
04-27-2018 10:59 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.