This discussion is archived
13 Replies Latest reply: Oct 8, 2013 9:35 PM by user8187964 RSS

Adding custom region to standard page

user8187964 Newbie
Currently Being Moderated

Hi,

 

I have added a custom region to a standard OAF page.

From the custom regions CO i am trying to access the VO attributes of another region on the same page but the VO handle keeps returning null.

 

My code in custom region:

 

CO

==

  public void processRequest(OAPageContext pageContext, OAWebBean webBean)

  {

    super.processRequest(pageContext, webBean);

    OAApplicationModule oaAM = pageContext.getApplicationModule(webBean);

    OAViewObject vo = (OAViewObject)oaAM.findViewObject("DeliveryDetailVO");

     if (vo != null)   
     {   

       String strLineId = vo.getCurrentRow().getAttribute("LineId").toString();   

       String strDeliveryDetailId = vo.getCurrentRow().getAttribute("DeliveryDetailId").toString();

       Serializable[] parameters = { strLineId, strDeliveryDetailId };

       oaAM.invokeMethod("initQuery", parameters);

      }

   }

 

AMImpl

======

public void initQuery(String strLineId, String strDeliveryDetailId)
{
  SerialNumberVOImpl SNVOImpl = getSerialNumberVO1();
  SNVOImpl.setWhereClauseParam(0, strLineId);
  SNVOImpl.setWhereClauseParam(1, strDeliveryDetailId);
  SNVOImpl.executeQuery();

    }

 

 

Any advice would be appreciated.

 

Thanks.

  • 1. Re: Adding custom region to standard page
    DilipG Journeyer
    Currently Being Moderated

    Hi,

     

    Please try below code.

     

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

      {

        super.processRequest(pageContext, webBean);

          OAWebBean anothercustomRN = webBean.findChildRecursive("AnotherRegRN"); //Catch Another Region here

         if (anothercustomRN != null)

              {

             OAApplicationModule oaAM = pageContext.getApplicationModule(anothercustomRN);

              if (oaAM!= null)

                 {

                   OAViewObject vo = (OAViewObject)am.findViewObject("DeliveryDetailVO");  //Catch VO

                    if (vo != null)  

                     {  

                     String strLineId = vo.getCurrentRow().getAttribute("LineId").toString();

                     String strDeliveryDetailId = vo.getCurrentRow().getAttribute("DeliveryDetailId").toString();

                     Serializable[] parameters = { strLineId, strDeliveryDetailId };

                     oaAM.invokeMethod("initQuery", parameters);

                    }

                }

              }

     

         }

     

     

    Thanks,

    Dilip

  • 2. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Dilip,

     

    Thank you for your reply.

     

    I don't actually know the name of the other region to plug into your sample code. I'm not sure where i can get that information from.

    The standard page i've added my custom region to is /oracle/apps/ont/delivery/webui/ONT_DELIVERY_PROCESS_PAGE 120.1

     

    Would you know how i can find this information out?

     

     

    Many Thanks.

  • 3. Re: Adding custom region to standard page
    DilipG Journeyer
    Currently Being Moderated

    Hi,

     

     

    1.Click on about this page of ONT_DELIVERY_PROCESS_PAGE. click expand All

    2.Check DeliveryDetailVO in ViewObject coulmn of standard page.

    3.if you get DeliveryDetailVO then check respective Region in Name coulmn of standard page.

     

    Also You can check Regions in page using jdr_utils.printdocument

       

    //Run Below command in Database

     

      DECLARE

        BEGIN

       jdr_utils.printdocument

       (p_document => '/oracle/apps/ont/delivery/webui/ONT_DELIVERY_PROCESS_PAGE');

        END;

     

     

    Thanks,

    Dilip

  • 4. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Dilip,

     

    I tried using the below region code & region name from the print_document output in your sample code but anothercustomRN returns null?

    akRegionCode="DELIVERY_PROCESS_CONTAINER"

    regionName="Delivery Process Lines"

     

    I've also tried using below code to get the rootAM and recursively find DeliveryAM which contains my DeliveryDetailsVO but i still can't seem to get to the DeliveryAM.

    The rootAM that it returns points to a different page OrderStatusAM, which contains 2 child AM's, both of which are not DeliveryAM. So i'm not sure how to access DeliveryAM to get to DeliveryDetailsVO.

     

    String amName = ""; 

    String objectivesAMName = "DeliveryAM"; 

    String nestedAMArray[] = pageContext.getRootApplicationModule().getApplicationModuleNames(); 

    pageContext.writeDiagnostics(this,"Root AM=>"+pageContext.getRootApplicationModule().getName() + " Child AMs=>"+ nestedAMArray.length,1); 

    OAApplicationModule currentAM = null; 

    currentAM = (OAApplicationModule)pageContext.getRootApplicationModule(); 

    for(int i = 0; i < nestedAMArray.length; i++) 

    amName = nestedAMArray[i]; 

    pageContext.writeDiagnostics(this,"Nested AM Name=>"+amName + "and amName.indexOf(objectivesAMName) "+amName.indexOf(objectivesAMName),1); 

    currentAM = (OAApplicationModule)pageContext.getRootApplicationModule().findApplicationModule(amName); 

    //Get the view names 

    String[] viewNames = currentAM.getViewObjectNames(); 

    for (int j =0 ;j<viewNames.length ;j++ ) 

    pageContext.writeDiagnostics(this,"Value "+j +viewNames,1); 

    if(!(amName.indexOf(objectivesAMName)==-1)) 

    pageContext.writeDiagnostics(this,"Found Handle to My Nested AM " + amName ,1); 

    break; 

    }

     

     

    Thanks for your assistance.

  • 5. Re: Adding custom region to standard page
    DilipG Journeyer
    Currently Being Moderated

    Hi,

     

    Is that two regions are available on single standard Page?

    If yes then You can catch region and respective VO Attribute using Controller extension.

    Please check with below scripts and paste xml result here.

     

    DECLARE

    BEGIN

       jdr_utils.printdocument

          (p_document      => '/oracle/apps/ont/delivery/webui/customizations/site/0/ONT_DELIVERY_PROCESS_PAGE'

          );

    END;

     

     

     

    Thanks,

    Dilip

  • 6. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Dilip,

     

    I'm new to this, so I just assumed as i was adding the custom region to the standard page, that I would have access to what is already on the page.

     

    XML result below.

     

    <?xml version='1.0' encoding='UTF-8'?>

    <customization xmlns="http://xmlns.oracle.com/jrad" version="9.0.6.0.0_45" xml:lang="en-US"

    customizes="/oracle/apps/ont/delivery/webui/ONT_DELIVERY_PROCESS_PAGE" developerMode="true"

    xmlns:oa="http://xmlns.oracle.com/oa"

    xmlns:ui="http://xmlns.oracle.com/uix/ui">

    <modifications>

    <move element="OntMsdsLanguage.OntDocumentCode" after="OntMsdsLanguage.OntItemCode"/>

    <move element="OntMsdsLanguage.ItemDescription" after="OntMsdsLanguage.OntDocumentCode"/>

    <move element="OntMsdsLanguage.OntDocumentTextid" after="OntMsdsLanguage.ItemDescription"/>

    <move element="OntMsdsLanguage.OntLanguage" after="OntMsdsLanguage.OntDocumentTextid"/>

    <move element="OntMsdsLanguage.OntMsdsdate" after="OntMsdsLanguage.OntLanguage"/>

    <insert after="OntMsdsLanguage.OntMsdsdate">

    <oa:messageStyledText id="serial_number" adminCustomizable="true" cellNoWrapFormat="false"

    dataType="VARCHAR2" initSortSeq="none" popupEnabled="false" popupRenderEvent="onClick"

    prompt="Serial Number" queryable="false" rendered="true"

    required="no" scope="." selectiveSearchCriteria="false" serverUnvalidated="false" sortState="no"

    styleClass="OraDataText" tipType="none" totalValue="false" userCustomizable="false" vAlign="middle"

    viewAttr="Serial_number"

    viewName="VHAODeliveryDetailsVO" warnAboutChanges="true" xmlns:oa="http://xmlns.oracle.com/oa"/>

    </insert>

    <move element="DeliveryLineQuality" after="DeliveryLineProcessInfo"/>

    <move element="pBar" after="DeliveryLineQuality"/>

    <insert after="pBar">

    <oa:flexibleLayout id="VhaFLDeliveryDetails" adminCustomizable="true" columns="1" disclosed="true"

    rendered="true" rows="1" showBorder="false" userCustomizable="false"

    xmlns:oa="http://xmlns.oracle.com/oa"/>

    </insert>

    <insert parent="ONT_DELIVERY_PROCESS_PAGE" grouping="flexibleContents">

    <oa:flexibleContentList id="OAInternalInsertedFlexibleContentList"

    xmlns:oa="http://xmlns.oracle.com/oa">

    <ui:contents xmlns:ui="http://xmlns.oracle.com/uix/ui">

    <oa:flexibleContent id="VhaFLCDeliveryDetails" adminCustomizable="true"

    flexibleLayoutRef="VhaFLDeliveryDetails" showBorder="false" userCustomizable="false">

    <ui:contents>

    <oa:stackLayout id="VhaFLCDeliveryDetails_stackLayout_auto"

    extends="/vha/oracle/apps/ont/delivery/webui/SerialNumberRN"/>

    </ui:contents>

                   </oa:flexibleContent>

                </ui:contents>

     

    </oa:flexibleContentList>

          </insert>

       </modifications>

    </customization>

     

     

    Thanks.

  • 7. Re: Adding custom region to standard page
    DilipG Journeyer
    Currently Being Moderated

    Hi,

     

    This Xml Says, /vha/oracle/apps/ont/delivery/webui/SerialNumberRN custom region you have added in Standard Page and View Object is VHAODeliveryDetailsVO.

    So Please try below code to catch VO It will work.

     

    OAViewObject vo = (OAViewObject)am.findViewObject("VHAODeliveryDetailsVO");  //Catch VO

     

    Thanks,

    Dilip

  • 8. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Dilip,

     

    VHAODeliveryDetailsVO is the custom VO that i created to retrieve the serial numbers of the items on the delivery lines.

    I am trying to access the standard VO DeliveryDetailsVO which contains the attributes DeliveryDetailId and LineId so i can pass those values to my custom VO VHAODeliveryDetailsVO as parameters.

     

     

    Thanks.

  • 9. Re: Adding custom region to standard page
    Mahesh112 Explorer
    Currently Being Moderated

    Hi,

     

    1. first check to which application module the Vo is attached.

    2. get the application module to your CO:

    OAApplicationModule am= (OAApplicationModule)pageContext.getRootApplicationModule().findApplicationModule("DeliveryAM");

    3. get the VO in your controller:

    OAViewObject vo = (OAViewObject)am.findViewObject("DeliveryDetailVO");


    now you can do whatever you want to do......


    Regards

    Mahesh

  • 10. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    HI Mahesh,

     

    Thanks for your reply.

     

    I have read may forum questions and many have outlined those steps.

    However my problem is, that i can't seem to get access to the AM where the VO is attached from my custom region's CO.

     

    When i try to get the AM using OAApplicationModule oaAM = pageContext.getApplicationModule(webBean) it returns my custom AM which i don't want.

    When i try to get the rootAM it returns a different standard AM (OrderStatusAM) which doesn't contain the VO i'm after. I go through all the nested AM's from the rootAM and none of those are the AM i'm after.

     

    So im not sure how to get to the AM that i want.

    On the page where i've added my custom AM, it shows the AM and VO that i want to access (DeliveryAM and DeliveryDetailsVO respectively), however i don't know how to get to it from my custom region CO.

     

    Any advice would be much appreciated as i've tried so many different ways without success.

     

    Thanks.

  • 11. Re: Adding custom region to standard page
    Mahesh112 Explorer
    Currently Being Moderated

    Hi,

     

    2. get the application module to your CO:

    OAApplicationModule am= (OAApplicationModule)pageContext.getRootApplicationModule().findApplicationModule("DeliveryAM");

    3. get the VO in your controller:

    OAViewObject vo = (OAViewObject)am.findViewObject("DeliveryDetailVO");

    Using the above code you can track whatever AM you want to track, just give the am name(If the AM is attached to your standard page).

    I had implemented tyhe above code one of my requirement and it is working for me.

    How you are using the above code, please paste here.

     

    Regards

    Mahesh

  • 12. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Mahesh,

     

    This is what i've tried.

    OAApplicationModule rootAM = pageContext.getRootApplicationModule();  

    OAApplicationModule DeliveryAM = (OAApplicationModule)rootAM.findApplicationModule("DeliveryAM");

    OAViewObject vo = (OAViewObject)DeliveryAM.findViewObject("DeliveryDetailVO");

     

    i also tried

    OAApplicationModule am = pageContext.getApplicationModule(webBean);

    OAApplicationModule DeliveryAM = (OAApplicationModule)am.findApplicationModule("DeliveryAM");

    OAViewObject vo = (OAViewObject)DeliveryAM.findViewObject("DeliveryDetailVO");

     

    The above 2 snippets of code both return null for the DeliveryAM.

     

     

    Thanks.

  • 13. Re: Adding custom region to standard page
    user8187964 Newbie
    Currently Being Moderated

    Hi Mahesh,

     

    There were multiple pages that displayed the same data. I was adding the personalization on the wrong page which was why it was returning a null value for the DeliveryAM. Once i sorted that out and applied your suggested code it worked.

     

    Thank you for yours & Dilip's help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points