This code will reside in Controller class.
Following sequence of events will take place for this type of extension
The extended custom controller class will replace the standard controller class.
Just prior to the page being rendered, processRequest of extended controller will be called.
In processRequest we will create a Submit Button Bean using getWebBeanFactory(),as in sample below.
Next, we will attach an event named "xxSubmitSendEmailButton" to this newly created button.
In the processFormRequest of extended controller, trap the event named "xxSubmitSendEmailButton"
Note- Event is trapped by checking the value of pageContext.getParameter(EVENT_PARAM)
Take appropriate action when this event is trapped
The actual code related to button is colour codedin brownish text
//add these import, if not already exist
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
//First create the Submit Button
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
//first excute standard functionality by call super as below
super.processRequest(pageContext, webBean);
//now create new button programatically
OASubmitButtonBean oasb= (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,"BUTTON_SUBMIT");
oasb.setID("xxSubmitSendEmailButton");
oasb.setUINodeName("xxSubmitSendEmailButton");
oasb.setEvent("xxSubmitSendEmailButton");
oasb.setText("xxSubmitSendEmailButton");
webBean.addIndexedChild(oasb);
}
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
String strEvent= pageContext.getParameter(EVENT_PARAM) ;
if ( strEvent.equals("xxSubmitSendEmailButton"))
{
//IMPORTANT Get this by calling the Function that loops for records.
//The string will contain the concatenation Email for which STANDARD CHECKBOX WAS CHECKED
String strEmailStringLearner = "This email address is being protected from spambots. You need JavaScript enabled to view it.;This email address is being protected from spambots. You need JavaScript enabled to view it." ;
pageContext.setForwardURL("xxMailOTA.jsp?paramEmailLearner="+ strEmailStringLearner,
null, // not necessary with KEEP_MENU_CONTEXT
OAWebBeanConstants.KEEP_MENU_CONTEXT, // no change to menu context
null, // No need to specify since we're keeping menu context
null, // request parameters
true, // retain the root application module
OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // display breadcrumbs
OAException.ERROR); // do not forward w/ errors
}}
3. On your PC, in <JDEV_USER_HOME>/myhtml/OA_HTML
create a jsp file xxMailOTA.jsp, with below contents
<head>
<script type="text/javascript">
function xxRzbCallEmail(paramEmailLearner){
document.location.href='MailTo:'+paramEmailLearner;history.go(-1);
}
</script>
</head>
<%
String paramEmailLearner = request.getParameter("paramEmailLearner");
System.out.println ( "paramEmailLearner=>" + paramEmailLearner ) ;
%>
<body onload=xxRzbCallEmail("<%=paramEmailLearner%>")>
</body>
IMPORTANT NOTE: This will be deployed to the $OA_HTML on server, when testing from eBusiness Suite
Overall Flow for business case
1. The processRequest of Controller will create a Submit Button, as it can't be done using Personalization.
2. In processFormRequest of Controller, when Submit Button is clicked, the value in StandardCheckbox will go into the corresponding View Object Attribute
3. We will loop for those records and calculate Concatenated Email String strEmailStringLearner
4. On Submission of Page, we will call xxMailOTA.jsp
5. xxMailOTA.jsp will do two things
a. Invoke MailTo on load of the jsp page
b. Send the navigation back to the main page
Comments
As always great stuff.. I have one question though.. How do you specify, if you want the button to be created at a specific location ( may ne next to a set of buttons which are already on the standard page)..
Thanks for all your help,
Suneetha.
In the above sample, we are using webBean.addInde xedChild(oasb)
This means that button will be added at the end of the page itself.
Howeve r, instead, you could also do, anyBeanOnPage.a ddIndexedChild( oasb)
You can add further parameters to addIndexedChild , so as to dictate the position within the parent container.
For example, a pseudo code is
Main Page Bean Structure
Region1
Region2
StackLayout for Buttons
====== =============== ======
//Firs t locate StackLayout for Buttons
------- --------------- -
OAStackLayout Bean oslb=(OAStackLa youtBean)webBea n.findIndexChil dRecursive("nam e of stacklayoutbean ");
//Next add the button to existing stacklayout which contains all existing buttons
oslb.ad dIndexedChild(n ewButtonbeanHer e)
In real world though, container for buttons may or may not be stack layout
Thanks,
Anil Passi
I am trying to convert the account values from legacy to oracle base tables(fnd_flex _values,fnd_fle x_values_tl).Th e problem is we could not load the segment qualifiers from the legacy table to base table.It is not displaying in front end.We are using R12.Please solve my problem.
I am looking for Oracle Application documentation in French, can you help out, where I can get these documents, like user manuals, setup manuals, etc...
Thanks
r ajiv
Think of it this way, even if we were able to add a submit button, what would we be able to achieve ?
Since we would want to call a piece of logic when the form is submitted using the SubmitButton, we would anyway need to customize the controller, and since we are customizing the controller, we can create the button there itself.
Tapash
As always, you are spot on.
Cheers
Ani l Passi
Is it possible to handle Key Board ENTER key through code . For example : if user press Enter key i want certain events to be handled or navigate to other page
Thanks
You have done a tremendous job. I learnt a lot from this site.
I want to implement that when any record is deleted say from table a mail is sent to that person. I tried the above written code on this site but not getting the result what i want.
Thanks
K uldeep Singh
First you need to check if there is any business event that fires when record gets deleted.
Next check if there is any custom API Hook which oracle calls
If not, then, you may extend Entity object, and override method deleteRow()
in DeleteRow, you will first call super.deleteRow and then call an email api
Thanks
Ani l
Actually an event is fired when the record is deleted. In this case what i have to do.
Can u suggest me some code for this.........
I got this code..........I s this ok...........
public void processFormRequ est(OAPageConte xt pageContext, OAWebBean webBean)
{
supe r.processFormRe quest(pageConte xt, webBean);
Strin g strEvent= pageContext.get Parameter(EVENT _PARAM) ;
if ( strEvent.equals ("xxSubmitSendE mailButton"))
{
//IMPORTANT Get this by calling the Function that loops for records.
//The string will contain the concatenation Email for which STANDARD CHECKBOX WAS CHECKED
String strEmailStringL earner = " passi.anilgmail.comThis e-mail address is being protected from spambots. You need JavaScript enabled to view it ; go4goldgmail.comThis e-mail address is being protected from spambots. You need JavaScript enabled to view it " ;
pageContext.s etForwardURL("x xMailOTA.jsp?pa ramEmailLearner ="+ strEmailStringL earner,
null, // not necessary with KEEP_MENU_CONTE XT
OAWebBeanCon stants.KEEP_MEN U_CONTEXT, // no change to menu context
null, // No need to specify since we're keeping menu context
null, // request parameters
true , // retain the root application module
OAWebBea nConstants.ADD_ BREAD_CRUMB_YES , // display breadcrumbs
OAE xception.ERROR) ; // do not forward w/ errors
}}
Than ks
Create a normal button by personalization . Export the personalization .
Replace the button by submitButton and delte unused attributes
import personalization . Bingo
I need assistance from U regarding Checkbox properties.
Ac tually I can able to display series of checkboxes along with some colomns by using wizard. but the problem for me is that, when I clicked some perticular chekboxes, I want to get corresponding records details only.... but I'm not getting hw to do this. Can U help me ????
Thanks
i flow the previous steps to create submit button in extended controller and i got error
WebBean style not supported
super .processRequest (oapagecontext, oawebbean);
OAWebBeanDateFi eld enddate = (OAWebBeanDateFi eld)oawebbean.findIndexedChildRecursive("HrSitEndDate");
OASubmitButtonB ean oasb= (OASubmitButtonB ean)oapagecontext.getWebBeanFactory().createWebBean(oapagecontext,"BUTTON_SUBMIT");
oasb.setID("Cal c");
oasb.setUINodeN ame("xxCalculat e");
oasb.setEvent(" xxCalculate");
oasb.setText("C alculate Days and Amount");
enddate.addInde xedChild(oasb);
Please can somebody explain to me why the code did not create the button as expected
kind Regards
Domini c
Keep up the awesome works guys I've added you guys to my personal blogroll.
RSS feed for comments to this post