Monday, December 7, 2009

Programatic PPR in OAF.

I was recently helping a friend in a customization in OAF, where through personalization, he wanted to put a ppr action in a seeded page in a seeded item. He was trying to do that customization using fire action, which was not acceptable by customer due to obvious reasons. Since, I think this section is missing in developers' guide, and is quite simple to approach, here is code you can write in process request of CO to attach programmatic PPR. lets take a simple example of attaching PPR to a message choice bean :

//In Process Request()
{
//Please attach PPR only to those UIX beans which support it
//otherwise it may not work
OAMessageChoiceBean mcb=(OAMessageChoiceBean)webBean.findChildRecursive("");
FireAction firePartialAction = new FirePartialAction("empPositionChange");
mcb.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR,firePartialAction);
}

//In process form request
if ("empPositionChange".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
{
//ur logic on PPR

//if PPR is attached in a table/hgrid child then we can find the row
//reference by
String rowReference =pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
}

I hope this helps. Happy oaf extensions :)!

13 comments:

Pradip C said...

This not working for a Hgrid. I am not sure why. I see when i bind values in the page , i get the values , but values entered in the text box are not entered.

Unknown said...

Hi Mukul,

This works fine for me
FirePartialAction firePartialAction = new FirePartialAction("budgetYesNo");
mcBudgetYesNo.setAttributeValue(mcBudgetYesNo.PRIMARY_CLIENT_ACTION_ATTR, firePartialAction);

But the issue is when I change the value in the messageChoiceBean, the page does client side validation on all the mandatory (required) fields, is there a way I can avaoid the validation happening ??

any help is greatly appreciated.

whois4274 {a-t} gmail {d-o-t} com

Unknown said...

Just an update ...

I could accomplish what I wanted using a different constructor of FirePartialAction..

But, if I set the submit to false there is some weird error related to regions .... the message is quite generic.

~whois4274

Unknown said...

Sorry, typo in my update

I could accomplish what I wanted using a different constructor of FireAction..

Unknown said...

Hii Mukul

I want to hide/show Region On button Click..

How can I solve dis Plz help me ASAP..

thnx in Advance,
nagesh

Unknown said...

Hi Mukul,

Really thanks, this is working for me. My requirement is to set fire action for message text input bean and i did it using the below code.

OAMessageTextInputBean SupplierItem_Bean = (OAMessageTextInputBean)webBean.findChildRecursive("SupplierItem");
FireAction firepartialaction = new FireAction("Supplier_Item_Change");
SupplierItem_Bean.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, firepartialaction);
pageContext.writeDiagnostics(this, "About to set partial action for Supplier Item ", OAFwkConstants.STATEMENT);

Unknown said...

I am trying to extend the page level CO, to create PPR for a Button which is added using personalization.

So now I have attached the FPR using below and am able to handle the event. However, am not able to get the rowreference.

In process Request:

FireAction firePartialAction = new FirePartialAction("callForecastPG");
Parameter param = new Parameter();
param.setValueBinding(new OADataBoundValueFireActionURL(custmBtn, pBudgetVersionId));
param.setKey("pBudgetVersionId");
Parameter[] params = {param};
firePartialAction.setParameters(params);
custmBtn.setAttributeValue(OAWebBeanConstants.PRIMARY_CLIENT_ACTION_ATTR,firePartialAction);

In process form request:

if(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM).equals("callForecastPG")) {
String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Row versionRow = am.findRowByRef(rowRef);
pageContext.writeDiagnostics(this, "AppsAssociates In Process Form Request TriggerWorkflow event :rowRef: "+rowRef, 1);
pageContext.writeDiagnostics(this, "AppsAssociates In Process Form Request TriggerWorkflow event : versionRow: "+ versionRow, 1);
if(versionRow!= null) {
pageContext.writeDiagnostics(this, "AppsAssociates In Process Form Request TriggerWorkflow event :versionRow : "+versionRow , 1);
String pBudgetVersionId = (String) versionRow.getAttribute("BudgetVersionId");
pageContext.writeDiagnostics(this, "AppsAssociates In Process Form callForecastPG event :pBudgetVersionId: "+pBudgetVersionId, 1);
}



Thank You
Chaitanya

Rajan Bhatia said...

Hi Mukul,

I have done the same and its working fine. But there is onemore field on the table which I am using as a link.

So if I m opening that link and closing that and coming back to my base page the 'rowReference' is returning null now.

paulsmith198914@gmail.com said...

To be honest, I was trying to do the same customization using fire action, which was not acceptable by customer due to obvious reasons. However, college paper writing service could help me solve this issue with ease!

Unknown said...

Hi Mukul,

I have followed the same steps but I couldn't get the handle of Row Reference when we are adding firePartialAction/fireAction programmatically. Any inputs are much appreciated.

Regards,
Vineel Danala.

Ankit Bhatnagar said...

Get exciting offers to do free shopping at amazon by using amazon gift card code generator online.

Unknown said...

Hi,

I have attached PPR to Populist ,whenever i select the value from Populist " Form Validation Failure " is coming due to mandatory fields in page .Please help me how to resolve it and unable to execute my custom code

Unknown said...

Hi All,
I have created a new message choice item inside table and I have configured it for fire partial action.
Based on selection of value for newly added message choice, I need to update one DFF attribute which is available in the same table row.
In PFR, I am trying to get the current row of the table for custom PPR action using EVENT SOURCE ROW REFERENCE. but, it is coming as NULL in this case of PPR based on new custom attribute.

Any idea on how to get the current row from PPR action of custom field inside table?

Thanks,
Sreenath