Monday, January 4, 2010

Set Context like fnd_global.APPS_INITIALIZE in OAF page controller


Question

How to set responsibility context in OAF like fnd_global.APPS_INITIALIZE is used in Oracle Application database.

When we try to open a OA page from a URL in a notification, on opening that page, system ask for "Switch Responsibility", but we want to set “Employee Self Service“ as default responsibility for that page.


Solution

Use pageContext.changeResponsibility method to set the context of the self service page.

Sample code

Extend NtfDetailsBodyCO controller to switch the context when page is first initialized.

package xxoa.oracle.apps.fnd.wf.worklist.webui;

import oracle.apps.fnd.framework.webui.OAPageContext;

import oracle.apps.fnd.framework.webui.beans.OAWebBean;

import oracle.apps.fnd.wf.worklist.webui.NtfDetailsBodyCO;

public class XXNtfDetailsBodyCO extends NtfDetailsBodyCO

{

public BILNtfDetailsBodyCO()

{

}

public void processRequest(OAPageContext pageContext, OAWebBean webBean)

{

super.processRequest(pageContext, webBean);

if(pageContext.getResponsibilityName() == null)

{

pageContext.changeResponsibility("EMPLOYEE_SELF_SERVICE", "PER");

}

}

}