How to capture the Task programmatically through Managed Bean (Adf – Soa Suite – Human Task)


This is another useful code that lets you to capture the task with full attributes from your Java Class (Managed Bean).


public TaskImpl getCurrentTaskFromWorkflow() throws WorkflowException {
    TaskImpl task = null;
    Map parameters=AdfFacesContext.getCurrentInstance().getPageFlowScope();
    IWorkflowServiceClient wfSvcClient = WorkflowService.getWorkflowServiceClient();
    ITaskQueryService queryService = wfSvcClient.getTaskQueryService();
    String contextId = (String)parameters.get("bpmWorklistContext");
    IWorkflowContext context = queryService.getWorkflowContext(contextId);
    String taskId = (String)parameters.get("bpmWorklistTaskId");
    String strTaskVersion = (String)parameters.get("bpmWorklistTaskVersion");
    if(taskId != null){
        int taskVersion = 0;
        if(strTaskVersion != null && !strTaskVersion.trim().equals("")){
                taskVersion = Integer.parseInt(strTaskVersion);
            } catch(NumberFormatException exc){
                taskVersion = 1;
        if(taskVersion == 0){
            task = (TaskImpl)queryService.getTaskDetailsById(context, taskId);
            task = (TaskImpl)queryService.getTaskVersionDetails(context, taskId, taskVersion);
    return task;

8 thoughts on “How to capture the Task programmatically through Managed Bean (Adf – Soa Suite – Human Task)

  1. Hi Victor,

    i think your post could be useful for what i’m trying to accomplish and i would be grateful for any bit of help you could give me.
    I see that in your code snippet you retrieve the contextId, the taskId and taskVersion from the parameters map of what i suppose is an ADF bounded task flow (BTF), but i wonder which values you pass as parameters to the BTF? I mean, you retrieve them dynamically, perhaps through EL expressions? If so, where these expressions point to? Or do you simply provide constant values as parameters to the BTF, deriving these constants from the knowledge you have of the human task definition?
    I thank you in advance.


    1. Hi Fabio,

      Sorry for the delay, i`m very busy on a project and actually i don`t have internet access on a client where i am working.

      The piece of code that i posted here is to be used on any java class, generally i use this on TaskFlows (bounded or unbounded) and this is useful for remote java class that need to access the oracle workflow remotely, on
      cases that you want to make your custom worklist application using the oracle remote api.

      You could use this using expression language (EL) too, suppose that you make your custom managed bean called MyBean and have the method called makePayment, in your jspx page you could make this: #{myBean.makePayment}, and inside
      this method you put the piece of code posted.

      I don`t understood your question or problem, if you want send email to me (, or add me to gtalk.


  2. Hi, Victor. I have class WorkflowService in such package. but i have no such method WorkflowService.getWorkflowServiceClient()?

    1. You can use method ADFWorklistBeanUtil.getWorkflowServiceClient() instead.
      Just so others would know. =)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s