Wednesday, January 15, 2020

How to Create Dialogue Page or Pop up window in OA Framework

How to Create Dialogue Page or Pop up window in OA Framework

 
Today I will show you how can we create a dialogue page in OAF. For example we have a page with apply button, On Apply button, We want to show dialogue page which will display message as " Do you really want to save the record?" with Cancel or Proceed button on it. When user click on Proceed then data should get saved into the table and if clicks on cancel then it should not save the record.
 
XXAP_SAVE DATA is fnd_message created in oracle apps which will store values as "Do you really want to save the record?"
 

CO Code:

 
if ("Apply"!=null)
{
OAException descMesg =  new OAException("XXAP", "XXAP_SAVE DATA", null, OAException.WARNING, null);
OADialogPage dialogPage = new OADialogPage(OAException.WARNING, descMesg,null, "", "");
 

                        dialogPage.setOkButtonToPost(true);
                        dialogPage.setNoButtonToPost(true);
                        dialogPage.setPostToCallingPage(true);

                        dialogPage.setOkButtonItemName("ProceedYes");
                        dialogPage.setNoButtonItemName("CancelYes");
                        dialogPage.setOkButtonLabel("Proceed");
                        dialogPage.setNoButtonLabel("Cancel");
                        pageContext.redirectToDialogPage(dialogPage);
 
                 // if user clicks Apply button, then record will save
             if (pageContext.getParameter("ProceedYes") != null)
             {  
                    am.invokeMethod("SaveChanges");
             }        
                // if user clicks No button, then it will rollback the transaction.
             else if (pageContext.getParameter("CancelYes") != null)
             {
             am.invokeMethod("rollbackChanges");
             }
}
 

AM Code:

 
                    public void rollbackChanges()
                    {
                    getOADBTransaction().rollback();
                    }
 
                    public void SaveChanges()
                    {
                    getOADBTransaction().commit();
                    }