Skip to Content
author's profile photo Former Member
Former Member

how to get current task ID in BPM

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2010 at 01:57 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Christian Loos

      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

  • author's profile photo Former Member
    Former Member
    Posted on Aug 09, 2010 at 08:42 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 22, 2014 at 12:38 PM

    You will have to use BPM API for this.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.