Wednesday 28 March 2018

How to Create Events in OAF Page Programmatically Through Controller Extension

How to Create Events in OAF Page Programmatically Through Controller Extension

We need events in OAF page to trigger our Custom Logic or Business Validations in the Application. If we are designing the OAF page through scratch then we can set events for each components or objects in the OAF page. There is no challenge in that. But if you are working with Standard OAF pages and where you cannot make any change in the Page layout or change the components properties of that OAF standard Page. Then in this case we take the  help of Controller Extensions to create events on any OAF components programmatically and achieve the business requirement. With the help of Controller Extensions we can easily create events on any objects of the OAF page like (button , Message Text Input) and then capture events to execute the Custom Code. Here we will create OAF events programmatically.
 
Here in this Example , I will took an example of one OAF page , where I have Email address user enterable field , and I want to put validation that , when user will enter email address in this field then system will validate that the user entered value should have character '@' in the Email address field.
To execute this code either this field should have predefined standard event  but we checked that there is not standard event for this email address user enterable field so in this case we will create OAF event for this email address user enterable field  programmatically through Controller Extensions.
 

How to Create OAF Events in OAF Page Programmatically

 
I have given the name of event is 'event1'
EmailAddress is the name of the OAF field on which we will create event ' event1'.
 
public void processRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)

 {

 super.processRequest(paramOAPageContext, paramOAWebBean);
 
oracle.cabo.ui.action.fireaction eventaction = oracle.cabo.ui.action.fireaction();

eventaction.setEvent("event1"); 

eventaction.setUnvalidated(true);

EmailAddress.setPrimaryClientAction(eventaction); \*EmailAddress is the name of the Feild for which we are creating event */
}

public void processFormRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)

    {
 
  super.processFormRequest(paramOAPageContext, paramOAWebBean);  

if("event1".equals(pageContext.getParameter(SOURCE_PARAM)))
 
{
 
IF(pageContext.getParameter("EmailAddress")!=null)
{
string email =pageContext.getParameter("EmailAddress");

if(email.indexOf('@')=-1)
{
throw new OA Expception("Invalid Email Entered",OAException.ERROR);
}
}
}
}
  }  
 


How to Create Events in OAF Page Programmatically

1 comments:

Rainbow Training Institute said...

your blog is really informative and helpful for me @ Rainbow Training Institute.

Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
Oracle Fusion Financials Online Training
Oracle Integration Cloud Online Training
Oracle Fusion Technical Online Training

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *