You are on page 1of 11

Using Expression Language in

Fusion Applications
An Oracle White Paper
January 2014
Using Expression Language in Fusion Applications

Introduction ....................................................................................................... 3
What is Expression language? ......................................................................... 4
Use Case Examples ........................................................................................... 4
Combination examples ..................................................................................... 8
References .......................................................................................................... 9

Using Expression Language in Fusion Applications Page 2


Using Expression Language in Fusion Applications

INTRODUCTION
This document forms a basic guide on using Expression Language (EL) inside
EL is used for adding addition logic to the
customizations made to Fusion Applications. This feature support comes as part
runtime customization of page
components. of the embedded Oracle WebCenter Page Composer, and the underlying ADF
technology.
As per the screenshot below, its primary use is for Page Composer-based run-time
customizations that can be made in both SaaS and On-Premises environments;
however it is also notable that JDeveloper and ADF support EL for design-time
page customization as well.

Figure 1 – Page Component Properties


The material given here is textual (as opposed to graphical) with many fine-grained
code examples that are provided to illustrate EL usage. In addition the content is
organized into common use-cases that hopefully encourages browsing, as opposed
to just use as a reference guide. The material is also complemented by some useful
resources at the end.

Using Expression Language in Fusion Applications Page 3


WHAT IS EXPRESSION LANGUAGE?
The examples provided in this document serve the following basic customization
needs, and whilst more advanced logic is possible venturing into great complexity
may take your customization beyond the scope that page composer is designed to
support.
• Dynamically set a field to default a specific value
• Dynamically set the display properties of a specific field
• Conditionally hide or disable a field or region
Generally EL statements return either a value such as ‘Richard’, or a Boolean such
as TRUE if the test is a success. These are then used in setting ADF page
component properties, such as Value, Required, or Visible. The examples in this
document include a mixture of return values used for setting various properties.
In ADF a partial page refresh is used to fire the EL logic, and careful testing in a
safe environment is needed to ensure your EL executes at the expected places. An
example might be properly defaulting values for fields upon actions such as create,
edit, and re-edit.
In addition, please be aware that not every page is intended to be fully
Always test and verify the support for EL in customizable, and even those that are may not always expose the component
each page component you wish to properties against which you might wish to add custom expression logic. As such
customize. expectations of what is possible should be set based on careful testing of each case,
and not on any broad assumptions.

USE CASE EXAMPLES


The following table contains EL examples that cover many of the common
requirements for customizing page component properties at runtime. It is not
intended to be exhaustive, but to give a good starting point for developing
effective EL expressions.
Each row is a requirement and they illustrate both syntax and some common utility
functions available. They have also been specifically tested with Fusion
Applications, as opposed to generic examples or those that use functions that may
not be available.
If you have any other examples that could be useful for our community please
provide feedback to the Developer Relations team at
http://blogs.oracle.com/fadevrel.

Title Short • Examples


Description
Basic Simple operators #{4>3}
Operators available in EL,

Using Expression Language in Fusion Applications Page 4


returning TRUE #{100.0 == 100}
or a result value.
#{(10*10) ne 200}
#{‘a’ < ‘b’}
#{‘hip’ gt ‘hit’}
#{bindings.MinReleaseAmt.inputValue * 10}
Conditional If-Then-Else #{customer.balance < 0 ? ‘red’: ‘black’)
Logic syntax is: #{
#{row.FlowTemplateName == ‘New Hire’ ?
[test] ? [then1] :
‘color:#0000FF’ : ‘color:#000000’}
[else2] }
#{row.FlowTemplateName ==’New Hire’ ||
Also the
row.FlowTemplateName==’Retire’ ? ‘color:#0000FF’ :
extended logical
‘color:#000000’}
operators are
“&&” (and),
“||” (or) and “!”
(is not)
Using with Include EL <html> <body> <h1>Benefits URL</h1><script>
Add inside the Value var x=””;
Content property of an if
added HTML (“#{webCenterProfile[securityContext.userName].busin
region. essState}” == “California”) {
x=”<a href=’http://www.uhc.com’
Uses the
target=’_blank’>United Health Care</a>";
webCenterProfile
} else
API for returning
{ x="<a href='http://www.bcbs.com'
user information.
target='_blank'>Blue Cross Blue Shield</a>";
}
document.write(x);
</script> </body> </html>
Create Set the value for http://www.yourcompany.com/#{webCenterProfile[se
Dynamic a URL to include curityContext.userName].businessState}.pdf
Content an EL
/personImage?personId=#{pageFlowScope.personId}
Links expression.

Access Skin Adjust your #{applCorePrefs.skinFamily}


Details content
#{requestContext.skinFamily}
properties based
on the underlying #{adfFacesContext.skinFamily}
custom CSS skin. #{changeModeBean.inEditMode ? 'medium' : 'light'}
User Get the value of #{applCorePrefs.displayNameLanguage}
the current user #{securityContext.userName}

Using Expression Language in Fusion Applications Page 5


Information properties from #{generalSettings.userTimeZone}
the session. #{generalSettings.preferredDateStyle}
#{generalSettings.preferredAccessibilityMode}
#{generalSettings.formattedCurrentDate}
#{facesContext.viewRoot.locale.language}
#{WebCenterProfile[securityContext.userName].Manag
erDisplayName}
Dates and Return the #{generalSettings.formattedCurrentDate}
Times current date, #{generalSettings.formattedCurrentTime}
time, or both. #{generalSettings.formattedCurrentDateTime}
Useful in writing #{applCorePrefs.locale}
conditions such
as preventing
post-dated
entries.
Resource Return the #{HcmPerformanceTopGenBundle['Header.Performan
Bundles proper translated ceWorkerOverview']}
text strings.
#{prcpoeditdocumentpublicuiBundle['Header.General.
Useful for
GeneralInformation']}
defaulting values
and labels. #{prcpoeditdocumentpublicuiBundle['AltTxt.Search.Sea
rchanLOV']}: #{bindings.VendorSiteCode1.hints.label}
Examples
illustrate various #{var.index == 0 ?
bundles in use hcmgoalcorepublicuiBundle['OLabel.IncludeinGoalPlan'
for different ] : null}
pages. #{applcoreBundle.NONE}
#{ResourcesGenBundle['AltTxt.Add.Addanobject']}
ADF The ‘bindings’ #{bindings.Comments.inputValue}
Bindings object is
#{bindings.ChangeOrderFlag.inputValue == 'Y' ||
essentially the
pageFlowScope.poRole != 'BUYER' ||
link between the
bindings.IsRateDateReadOnly.inputValue}
UI and the
backend data #{ bindings.StatusCode.inputValue == 'CANCEL' ||
model. bindings.StatusCode.inputValue == 'OVERDUE'}
#{node.bindings.GoalIncludedInPlan.attributeValue}
#{bindings.GoalUrl.inputValue != null}
ADF Tables Table rows are #{row.Weighting != null ? row.Weighting : '0'}
referred using
#{row.bindings.IsEmpRatingGiven.inputValue == "Y"
row.[columnNa
? true : false}
me].

Using Expression Language in Fusion Applications Page 6


Page Some pages #{node.GoalPlanAssignmentId != null}
Structure support the use
#{node.EnableWeightingFlag == 'Y'}
Properties of native
Webcenter #{attrs.view eq 'imageLink'}
object
components.
Test yourself to
verify.
Page Flow The #{pageFlowScope.poRole != 'BUYER'}
Scope pageFlowScope
#{pageFlowScope.pTaskName == 'Manager Approval'
object is a
? true : false}
commonly
available JSF #{pageFlowScope.pGoalProfiles['HRG_ENABLE_GO
bean for AL_LIBRARY'] == 'Y'}
accessing context #{pageFlowScope.accessCode eq 'FULL_ACCESS' ?
variables. More false : true}
here.
#{pageFlowScope.searchDocumentManagedBean.navig
ateToDocumentHistoryPageFromHeader} (in
documentCommandLink for redirect)
Security The #{securityContext.userGrantedPermission['permissionC
Context securityContext lass=oracle.adf.share.security.authorization.MethodPerm
object provides ission;target=oracle.apps.prc.pon.permission.createSupp
access to lierNeg; action=invoke']}
functions for
#{securityContext.userGrantedPermission['permissionC
checking the
lass=oracle.adf.share.security.authorization.MethodPerm
users security
ission;target=oracle.apps.prc.po.permission.changeSuppl
access at
ierSite;action=invoke']}
runtime.
#{securityContext.taskflowViewable['/WEB-
This does not
INF/audit-expense-report.xml#audit-expense-report']}
replace properly
customizing the #{securityContext.authenticated}
security roles to #{securityContext.userName}
control security. #{securityContext.userInRole['roleList']}
#{securityContext.userInAllRoles['roleList']}
#{securityContext.taskflowViewable['target']}
#{securityContext.regionViewable['target']}
#{securityContext.userGrantedResource['permission']}
#{securityContext.userGrantedPermission['permission']
}
Accessing In some cases it #{bindings.GoalPlanAssignmentVO.hints.PriorityCode.
View is possible to mandatory}
access the

Using Expression Language in Fusion Applications Page 7


Objects ADFbc View #{!GlobalAreaBackingBean.anonymousUser}
Objects to
#{finUiUtil:containsMoreThanOneRow(bindings.Enter
interrogate
PurchasingDocumentBUAccessUiVO.viewObject)}
additional data
that may not be #{finUiUtil:containsNoRows(bindings.CompensationIt
displayed on the em1Iterator.viewObject)}
page (via the #{backingBeanScope.GoalOverviewBean.keyAttrRead
backing bean). Only}
#{backingBeanScope.PerfDocGoalBean.keyAttrReadO
nly}
#{bindings.ComponentPropertiesVO.viewable ?
applcoreBundle.TABLE_EMPTY_TEXT_NO_ROWS
_YET :
applcoreBundle.TABLE_EMPTY_TEXT_ACCESS_D
ENIED}
#{backingBeanScope.PersonSearchParams.professional
QueryMode ?
adfBundleForPersonSearch['Header.AdvancedSearch']:
adfBundleForPersonSearch['Header.Search']} (text for
search region)
Firing On some pages it #{backingBean.<Bean Name>.<bean method>}
Methods may be possible
#{myBean.addNewOrder('orderName')}
to call methods
from the backing #{backingBeanScope.GoalInformationBean.handleDele
bean through teGoalURL} (from commandImageLink actionListener
EL, such as a property)
buttons #{backingBeanScope.GoalBean.launchWorkerRemove
actionListener. GoalWarningPopup} (also actionListener)
Note: This is
predominantly a
design-time
customization.

COMBINATION EXAMPLES
The following few examples illustrate some more examples of EL usage in
determining the correct property for a component based on the runtime
environment.
These are intended to illustrate how you can combine some of the items from the
table above.

Using Expression Language in Fusion Applications Page 8


#{ pageFlowScope.pShowPageReadOnly == 'Y' ||
bindings.StatusCode.inputValue == 'CANCEL' ||
bindings.StatusCode.inputValue == 'OVERDUE' ||
pageFlowScope.pGoalEditMode == 'PENDING_GOAL' ||
bindings.StatusCode.inputValue == 'COMPLETED'}
#{pageFlowScope.pGoalEditMode != 'CREATE_GOAL' &&
(pageFlowScope.pShowPageReadOnly == 'Y' ||
backingBeanScope.GoalInformationBean.keyAttrReadOnly ||
bindings.StatusCode.inputValue == 'CANCEL' ||
bindings.StatusCode.inputValue == 'OVERDUE' )}
#{pageFlowScope.pParentFlow != 'MANAGER_HOME' &&
pageFlowScope.pGoalUIContext !='ProfileUI' &&
pageFlowScope.pGoalEditMode == 'CREATE_GOAL' &&
pageFlowScope.pGoalUIContext != 'MassRequestUI'}
#{(pageFlowScope.pGoalProfiles['HRG_GOAL_COMPLN_REQ_APPR'] ==
'Y' || pageFlowScope.pGoalProfiles['HRG_KEY_ATTR_CHG_REQ_APPR']
== 'Y') ? HcmGoalTopGenBundle['OLabel.SubmitandAddAnother']:
HcmGoalTopGenBundle['Action.SaveandAddAnother']}
#{pageFlowScope.pReadOnlyDetails || (bindings.MandatoryFlag.inputValue ==
"Y" ? true : false)}
#{(pageFlowScope.pPerfDocTab4Name != null and
pageFlowScope.pPerfDocTab4Name != '') ?
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'WFF' ?
pageFlowScope.pShowEmpFeedbackSection :
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'MFF' ?
pageFlowScope.pShowMgrFeedbackSection :
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'OS' ?
pageFlowScope.pShowOverallSummarySection :
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'QUESTIONNAIRE' ?
pageFlowScope.pShowQstnrSection :
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'GOAL' ?
pageFlowScope.pShowGoalSection :
(pageFlowScope.pPerfDocTab4SectionTypeCode == 'REG' ?
pageFlowScope.pShowCompetencySection : true)))))) : false}

REFERENCES
The following are three EL resources where further information can be found to
support specific requirements or provide a general background.

• JavaEE Expression Language Tutorial

Using Expression Language in Fusion Applications Page 9


• Webcenter Expression Language Reference Guide

• Developer Relations YouTube channel for demonstrations and examples

Using Expression Language in Fusion Applications Page 10


Using Expression Lanaugage in Fusion Applications
January 2014
Author: Richard Bingham, Developer Relations

Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.

Worldwide Inquiries:
Phone: +1.650.506.7000
Fax: +1.650.506.7200
oracle.com

Copyright © 2014, Oracle. All rights reserved.


This document is provided for information purposes only and the
contents hereof are subject to change without notice.
This document is not warranted to be error-free, nor subject to any
other warranties or conditions, whether expressed orally or implied
in law, including implied warranties and conditions of merchantability
or fitness for a particular purpose. We specifically disclaim any
liability with respect to this document and no contractual obligations
are formed either directly or indirectly by this document. This document
may not be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without our prior written permission.
Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle
Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.

You might also like