cancel
Showing results for 
Search instead for 
Did you mean: 

how to get current task ID in BPM

Former Member
0 Kudos

Hi guys,

I have a requirement where I need to get the current active UWL task id in BPM context. I have seen the following code to create a direct execution url for a BPM task.

// begin session
      IUWLSession uwlSession;
      uwlSession = uwlService.beginSession(uwlContext, sessionIdleTimeout);
      uwlContext.setSession(uwlSession);

      IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
      QueryResult result = itemManager.getItems(uwlContext, null, null);
      ItemCollection items = result.getItems();
      Item item = null;
      for (int i = 0; i < items.size(); i++) {
        item = items.get(i);
        Map params = new HashMap();
        params.put("taskId", item.getExternalId());
        String executionURL = WDURLGenerator.getApplicationURL("sap.com/tc~bpem~wdui~taskinstance", "ATaskExecution", params);

This works fine, but this is looping through all the tasks assigned to a user. How do I get the current task ID. I want to use the code inside webdynpro application which is caled as a human activity in BPM. When this WebDynpro application is called I would like to know the current task ID.

As an FYI , UWL configuration passes the current task ID as a Dynamic parameter to "sap.com/tcbpemwdui~taskinstance"

application.

Please help if someone can identify how to get this value in my custom WD.

Thanks,

Yomesh.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member191643
Active Contributor
0 Kudos

You will have to use BPM API for this.

Former Member
0 Kudos

Hello Sidhhart,

Thanks for the reply, but I don't find any API which gives me taskId of current executing task.

But I guess I can achieve that by calling 'getParameter' for 'TaskId" from wdcontroller if I am not wrong.

Thanks,

Priya

former_member191643
Active Contributor
0 Kudos

Yes. there is no API to get the current task.

Try this:

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("wi_id");


But i still say a bit confused with your requirement.


The task id gets created only upon creation of a task. And you want this current task id in the BPM Process context? How is it possible unless and until some action takes place and the data is passed from WDJ to BPM Context?


Please clear my doubt.

Former Member
0 Kudos

I solved it myself by using a intermediate WebDynpro Application. I called the intermediate WD application on UWL item launch and passed the Item ID to it using URL parameters.

Former Member
0 Kudos

Hello Yomesh,

I have similar requirement in my project.

Could you please elaborate how did you do that?

Thanks,

Priya

Former Member
0 Kudos

Hey Guys,

Please tell me if this is even possible or not.

Or if my explaination of question is not clear, please let me know. I can elaborate more on what I am looking for.

Thanks,

Yomesh

ch_loos
Advisor
Advisor
0 Kudos

Hi Yomesh,

are you talking about the BPM task ID? How do you plan to use it in your WD view?

The UWL task id seems to be available in your code snippet.

Regards,

Christian

Former Member
0 Kudos

Hi Christian,

I am refering to the UWL task ID. Yes you are right, the UWL task ID is available in m,y code snippet, but the problem is I have to loop through all the task assigned to a user.

This gives me all the task ID's. I am not able to identify the current task ID.

Imagine I have 10 tasks in my UWL. Now I clicked on task No 2. Then a WebDynpro Application is launched as a human activity and here I want to know what is the current task ID.

I know we can get all the task ID's , but how to identify what is task ID for task NO 2, in case user clicks on task2.

Thanks,

Yomesh