Wednesday 21 March 2018

How To Get the LOV Selection Event in OAF Controller For CO Extension

How To Get the LOV Selection Event in OAF Controller For CO Extension

We often need in OAF Controller Extensions to get the Events from the Page to Execute our Custom Code. Suppose If we want to Execute or want to Change some values in the OAF page when the user will select the LOV from the OAF page. For this We can use this below code to Find the LOV Selection Event in the OAF controller and write our custom code inside that Event for Controller(CO) Extension.
 
How To Get the LOV Selection Event in OAF Controller For CO Extension
 

How To Get the LOV Selection Event in OAF Controller For CO Extension

There are two ways by which you can get the LOV selection event in the OAF page.
 
1.pageContext.getLovInputSourceId()
2.pageContext.getParameter(SOURCE_PARAM)
 
 
You can write your Code in the Process Form Request of your CO Extension in this manner
 
You should know the name of your LOV Item in your OAF page so that you can compare this Name with all the Lov selection events in the OAF page because it could be possible there are more then 1 LOV's in the OAF page so you have to distinguish for which LOV selection you want to execute your custom code. 
 
if(pageContext.isLovEvent())
 
  {
String lovInputSourceId = pageContext.getLovInputSourceId();
  if("Country".equals(lovInputSourceId))
{
System.out.println("You can write your Customer Code inside this");
paramOAPageContext.writeDiagnostics(this, "LOV Selection ", 2);
 }
 } 
 

How to Compare the LOV selected value by user in the OAF Page.

 
 if(pageContext.isLovEvent()) 
 {  
      String lovInputSourceId = pageContext.getLovInputSourceId(); 

      if("Country".equals(lovInputSourceId)) {
      paramOAPageContext.writeDiagnostics(this, "LOV Selection ", 2);
           Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId); 
           if(lovResults!=null) 
           { 
                String Country1 =(String)lovResults.get("Country"); // "Country" is the Return Item specified in the lovMap  

           paramOAPageContext.writeDiagnostics(this, "Selected Country "+Country1);
 
 
 
This code is used to do comparison with the LOV selected value in the OAF Page in CO Extension
 
 
How To Get the LOV Selection Event in OAF Controller For CO Extension
 



 

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

Name

Email *

Message *