Tuesday, August 17, 2010

Passing Parameter to Bounded TaskFlows in UI Shell Dynamic Tabs

Passing parameters to UI shell was one of the genuine requirements and was resolved with some great works by ADF Experts like Richard, Pino, Steve, Chris. There is long history in the development of its solution which could be found in Oracle Forum for ADF UI Patterns & Best Practices.
Initially to get this working we had to customize oracle-page-templates-ext.jar and as far as I know Pino came up with very good blog ADF UI Shell: Extending the UI Shell to Allow Passing of Parameters to Bounded Task Flows that describes this in very detailed steps. Later Oracle logged the bug for this issue and solution was released as an extension as Oracle Dynamic Tab Template.
But now since solution is released we don't need to do any customization and in this blog I would be showing how to achieve this without going through all the pain :)

Before you start, download the latest 'oracle-page-templates-ext.jar' from OTN if you have not already done so. As said before it is available as an extension, so to get this, you can open JDeveloper go to Help - Check for updates.. and install Oracle Dynamic Tab Template'.

From the bean where you are trying to launch the dynamic tab add below code:

Map parameterMap = new HashMap();
parameterMap.put("",  );

parameterMap.put("",  );
........
// use over loaded _launchActivity method to launch taskflow as dynamic tab.
_launchActivity( "Tab Title" , "TaskFlow with path", false, parameterMap);

that's all needed to be done .....

Recently I found there are still some issues while implementing this.. so I created a blog 'Test Case : Passing Parameters to Bounded Taskflows using Oracle Dynamic Tab Template' detailing all the steps for this and also providing link for a sample test case.

5 comments:

  1. Hi,

    thanks for the info. I updated the dynamic tab template as you said, but i can't call _launchActivity method passing in the parameters map. I also checked the addTab method of TabContext object, and there's no way to pass the parameters. I'm using JDev 11.1.1.3.0 build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. May you please help me with this?!? Thanks, bye! Fabio

    ReplyDelete
  2. There could be two reasons to it:
    1. You may not have downloaded new Dynamic Tab shell template. To do that go to JDeveloper,
    Help - Check for updates.. and install Oracle Dynamic Tab Template'.
    2. Paste this method in you bean and try again:
    private void _launchActivity(String title, String taskflowId, boolean newTab, Map parameters ) {
    try {
    if (newTab) {
    TabContext.getCurrentInstance().addTab(title, taskflowId);
    } else {
    TabContext.getCurrentInstance().addOrSelectTab(title,
    taskflowId);
    }


    } catch (TabContext.TabOverflowException toe) {
    // causes a dialog to be displayed to the user saying that there are
    // too many tabs open - the new tab will not be opened...
    toe.handleDefault();
    }
    }

    Please note, in any case you need to have latest Oracle Dynamic Tab Template.

    ReplyDelete
  3. Hi,

    thanks for your prompt reply, but i still can't figure out how your solution works. In the code snippet you posted in your reply the "parameters" argument you provide to _launchActivity method is never used inside the method body: how can that works? Thanks for the help.
    Fabio

    ReplyDelete
  4. Well this is the new overloaded method for launch activity.. copy this method to you bean and then you can call this method as mentioned in blog.

    ReplyDelete
  5. If you still face an issue, let me know your requirement and also give me your email id. I can mail you a sample test case.

    ReplyDelete