X

It's All About the Platform.

  • March 3, 2015

Examples of Expression Language from the Customer Connect Event

Richard Bingham
Senior Development Manager

 

Recently we've been looking more at Expression Language and its use in Page Composer for customizing UI component properties. Increasingly we're seeing more customer requirements and so we ran a Oracle Customer Connect session entitled "Expression Language (EL) and Cloud Applications" that was open to all.

The session started with a discussion about several presubmitted questions, continued with a quick demo of EL in page composer, exposed some hints-and-tips, and finished with some addition use-case demos from Tim Warner of Certus Solutions. Whilst you can replay the whole content from here (streaming video or ppt), I thought it might be interesting to take a few points from the session and highlight them here.

EL Documentation

We were asked beforehand if we could verify the documentation available for use with Expression Language. This currently comprises the following recommended resources, although of course other specific articles and web pages may cover specifics:

 

 

 

Interesting Q & A

From the questions we saw (both presubmitted and taken online), the following information was acknowledged as being helpful:

What data can I use on the pages?

Currently there is no documentation which lists out all the fields and attributes available for use in Expression Language for each-and-every page. This is because what you see as pages are part of  underlying ADF code artifacts which are built specifically for each use-case. The recommended approach is to investigate the pages where your customization would apply and use this to understand the component property values in use. We offered to provide some additional cheat-sheet type documentation if our community can help us identify pages which are most commonly customized - please use the comments below.

Can I use more programming language features?

Expression language in Page Composer only allows you to write code which evaluates a condition and provides a result (string value or Boolean). It is not a programming environment, but - as the name suggests - a way to include short expressions. As such you cannot create variables in your code and there are no utility functions available to call.

How can I manipulate Date fields?

Support for date values is essentially limited to what you can do with them as strings. There is no support for creating, comparing, or formatting of the Date data type.

How are translations handled?

The use of Text Resources (i.e. resource bundles) is strongly recommended when writing EL to customize your labels. You should use these predefined texts inside your expressions, such as the following examples:

#{row.FlowTemplateName == adfBundle['oracle.adf.view.page.editor.resource.
ComposerOverrideBundle']['RT_S_NEW_HIRE'] ? 'color:#0000FF' : 'color:#000000'}
#{facesContext.viewRoot.locale.language = = 'en' ? adfBundle['oracle.adf.
view.page.editor.resource.ComposerOverrideBundle']['RT_S_XXXComp'] : 
[HcmCompTopGenBundle['OLabel.Grade.SalaryGrade'] } 

 

When does the EL fire exactly, and can this be controlled?

Generally speaking the EL fires as part of the page rendering process, normally upon initial delivery. It may re-fire upon an implicit partial page refresh (PPR - done by the product code), such as when a child region  is updated based on the parent region, however it does require communication with the server for the execution to take place. As such you will need to ensure your EL complements the page usage. Setting one field based on another will work fine upon first display, however if you expect dependent fields to change dynamically all the time then often this is not possible.

At this time you cannot add EL or a script (such as JavaScript) to a page which causes it to automatically reload or redirect based on specific EL condition.

Can I combine EL conditions?

Yes, you can have multiple conditions inside your EL expression delimited by the #{...} characters. Obviously the result still applies to just one component property. For example the following returns True if various fields are the values given:

#{pageFlowScope.pGoalEditMode != 'CREATE_GOAL' && 
(pageFlowScope.pShowPageReadOnly == 'Y' || 
backingBeanScope.GoalInformationBean.keyAttrReadOnly || 
bindings.StatusCode.inputValue == 'CANCEL' || 
bindings.StatusCode.inputValue == 'OVERDUE' )} 

In addition, if you want multiple expressions within the response for setting a value property, then you can have multiple #{} sections, as illustrated by this example which adds both the username and Person ID into the returned string:

http://www.yourcompany.com/#{securityContext.userName}.pdf/personImage
?personId=#{pageFlowScope.personId}

Where can I use Expression Language?

We demonstrated how the Desktop UI exposes more component properties against which you can add expressions compared with the Simplified UI that commonly exposing just the Label and Shown properties.

In addition Tim from Certus gave a demo of the Navigator Menu which also allows EL to govern the Rendered property of each menu item, allowing you to specify conditional display rules. It was mentioned that of course this does not replace the standard security role/privilege configuration features. A video demonstration of doing the menu customization is available from our YouTube channel here:

What's Up Next?

We're considering delivering more in this series, and would love your suggestions or feedback on the following proposals:

  • More on Expression Language with further discussion and more examples
  • Using Page Composer to change page layouts and add custom content
  • Dashboards: combining BI Composer with Page Composer for custom analytics

Please use the comments below, or Customer Connect.

 

 

Join the discussion

Comments ( 13 )
  • guest Friday, March 13, 2015

    Could you please provide information on "Restricting/enforcing user NOT to enter field value with special characters"?

    Is it possible?

    Can we correct/remove special characters when user submit the transaction using Expression language?


  • Richard Bingham Friday, March 13, 2015

    Hi.

    Page Composer (expression language) is not the best solution for adding field/data validation, it is more about conditionally setting component properties. We are considering new features to extend the standard validation, however it is very much planning at this time. I'll include this comment however, so thank you for sharing.

    Of course, fields often prevent the entry of unusual characters, such as html for cross-site scripting, however if you have a specific requirement that is not currently covered I would recommend you raise it with Oracle Support, including why they're entering the special characters and how that impacts your business.

    Kind regards

    Richard


  • guest Sunday, March 22, 2015

    Hi,

    Can you please indicate if I can use an Expression Language in order to hide or to display content items (competencies) based on the user security role ?

    Regards.


  • Jani Rautiainen Monday, March 23, 2015

    See security related EL here:

    http://docs.oracle.com/cd/E15586_01/web.1111/b31974/adding_security.htm#BGBBHIID

    Do note that in general you should not base the behavior on roles as their names may change, rather use permissions.

    --

    Jani Rautiainen

    Fusion Applications Developer Relations

    https://blogs.oracle.com/fadevrel/


  • Jani Rautiainen Monday, March 23, 2015

    Also see the whitepaper included in the post:

    https://blogs.oracle.com/fadevrel/resource/EM_WP.pdf

    for examples on the security context.

    --

    Jani Rautiainen

    Fusion Applications Developer Relations

    https://blogs.oracle.com/fadevrel/


  • Vinay Saturday, May 9, 2015

    Hi,

    I have a similar requirement from my customer on Personalization. It is primarily around defaulting few seeded fields on the manage employment page based on another seeded drop down value on the same page.

    Details:

    Customer has two Custom/ Assignment Person Types under seeded person type Worker.

    They are called Staff and Labor.

    Requirement is to default and greyout(no edit possible) the Notice Period and Probation period fields on the same manage Employment page below.

    More information on this SR 3-10672254538 : Notification Period and probation Period defaulting based on Employee type.

    Richard, do you think it would be possible to achieve this, based on the value of Person Type. My only question is how to make the page reload whenever the value of the drop down is changed. Only then can the period dates also have a custom impact. That is my understanding.


  • Richard Bingham Monday, May 11, 2015

    Hi Vinay,

    Thanks for your question. Forcing a page or region reload is not possible in Page Composer/EL, and as you suggested as the page component properties are calculated only upon generation / rendering.

    I will look into proposing this as an enhancement for future release, as it makes sense to offer support for this.

    Thanks

    Richard


  • guest Friday, July 24, 2015

    Hi Richard,

    I have a query on conditionally hide the 'Add Goal' button on Development and Growth Card of My Portrait page

    Requirement: Employee cannot add goal in Development and Growth card. Line manager can add goal for his direct.

    Tried following ELs:

    1. #{securityContext.userInRole['PER_LINE_MANAGER_ABSTRACT']}

    Actual result:

    a. Add icon is still visible for employee in My portrait

    b. Add icon is not visible for manager in his direct's portrait

    2. #{(pageFlowScope.pWorkerPersonId ==

    pageFlowScope.pLogInPersonId) && (pageFlowScope.pPerformerRole == 'WORKER')}

    Result: Employee, line manager both are not able to see "add goal" icon

    3. #{pageFlowScope.pPerformerRole == 'WORKER'? false : true}

    Result: Worker is able to see add goal icon but manager is not able to see when he checks his direct’s portrait

    4. #{pageFlowScope.pPerformerRole == 'WORKER'? true : false}

    Result: Employee, line manager both are not able to see "add goal" icon

    Please suggest how to achieve the requirement


  • Srini Sunday, January 31, 2016

    Hi

    I want to know the parameter value for household record to embed a dashbaord report specific to that household record contextually. we have got parameters for customer, contact, lead, and opty objects but not for household, can you reply with the expression for household similar to the following

    - Customer ID :#{sessionScope.zcmAnalyticsCustomerId}

    - Contact Id: #{sessionScope.hzAnalyticsContactPartyId}

    - Contact Name: #{sessionScope.hzAnalyticsContactName}

    - Opportunity Id: #{sessionScope.mooAnalyticsOpportunityId}


  • Richard Bingham Monday, February 1, 2016

    Hi.

    I had a quick search for this information, related to the Household (GroupVO) however I could not find the precise value you need.

    I did add this requirement to the following Enhancement Request which was already open to give you what you're after.

    ER 21129789 - NEED TO DOCUMENT THE PARAMETERS TO LINK BI REPORT IN SUI

    I'll also follow up with the owner and pass on anything I can get, but please feel free to add to this yourself (via a SR) also if the need is urgent.

    Kind regards

    Richard


  • Clara Thursday, September 22, 2016

    Hi,

    I have created a descriptive flexfield for an instructions to show in a and absence record. The DFF lies in the 'Descriptive Information' box. I want different instructions to show for different plans (like vacation and jury duty plans). Is this possible to make instructions visible on only certain types of absence records?

    Thanks,

    Clara


  • Kshitiz Anand Friday, March 10, 2017

    Hi,

    I have added a HTML button using Page Composer. In the properties of this HTML component.

    The page which I have customized is an Item Page which contains many attributes like Item Number, Description etc.

    I want to get the value of Item Number inside the properties of HTML component. My requirement is to add action to the Submit button added by Page Composer based on the Item Number.

    Thanks,

    Kshitiz


  • guest Friday, March 10, 2017

    Hi Kshitiz

    It is not possible to add a data bound component in the HTML region. It may be possible to use JavaScript to get the value from another component on the page however.

    Similarly the actionListener related to buttons are part of the page framework and submit back to the code on the middle tier. Again a JavaScript expert might be able to include code to fire a sister event however this will get pretty complex.

    Kind regards

    Richard


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha