Expand my Community achievements bar.

Get process id and task id for long-lived process?

Avatar

Level 2

Scenario:

I have created a long-lived process that will assign a task to a user. The user then has two options to Accept or Reject. Accept route saves the data to the database. Reject does not save. 

I want to invoke this process in .Net and need to know how to get the current task id of the process invoked. I know that invoking the async method returns an invocation id. How do I use this value to get to the current task id of the process?

I then want to be able to call a method to complete this task outside of workspace. For example, on my form I would have an Approve and Reject button. If user clicks Approve it would choose the approve route in the process and if Reject button clicked it would take the reject route. What would be the API call to do this in .Net that would trigger the appropriate route given the button clicked on the Form?

Any help would be appreciated.

4 Replies

Avatar

Level 8

What do you mean by "the current task ID of the process"? Do you want the ID of a specific task that the User service created, or the ID of the process?

Avatar

Level 2

The id of the specific task created by the User Service. I want to use that task id to complete the task outside of workspace environment through .Net code.

Avatar

Former Community Member

If you are not using any parallel tasks, execute this script against the LC database.  This should give you the current task id

Select max (id) from tb_task where process_instance_id = <id>

Avatar

Level 8

Generally, the TaskManager service is used to query tasks. I've not used the wsdl for that service before so I can't help you much there.

In the process, you can get the taskID if you use a custom render service. To externalize the taskID you'd have to do something like have the render service save the ID to a file, or call a web service and pass it to the service, or use JMS service, or email service.....