EL Expression Reference
Expression Language (EL) is used throughout DonorPoint to make content dynamic — conditionally showing fields, personalizing emails, computing values, and integrating with external data. This page is a reference for writing EL expressions in DonorPoint.
When EL Is Evaluated
EL expressions (surrounded by #{ and }) are evaluated by the DonorPoint server at the following points:
| Where | When Evaluated |
|---|---|
| Custom field Rendered Rule | Every time the form re-renders |
| Custom field Prompt / Hint text | When the form renders |
| Page template merge tags | When a form page loads |
| Email content merge tags | When each email is sent |
| Confirmation page content | When the confirmation page is shown |
| Report column definitions | When a report runs |
| Autoresponder templates | When each autoresponder is sent |
| ScriptModule creation scripts | When the associated event fires |
Basic Syntax
An EL expression follows the pattern #{expression}. In email and page template content, expressions are evaluated and their output replaces the tag:
Dear #{contact.firstName},
Your gift of $#{purchaseOrder.amount} to #{purchaseOrder.campaign.name} was received.
Expressions can include:
- Property access:
#{contact.lastName} - Method calls:
#{contact.getEmployer().name} - Arithmetic:
#{purchaseOrder.amount * 12} - String concatenation:
#{contact.firstName.concat(' ').concat(contact.lastName)} - Conditional (ternary):
#{contact.firstName != null ? contact.firstName : 'Friend'} - Comparisons:
#{purchaseOrder.amount gt 1000}
Null Safety
Always guard against null values when chaining property access:
#{not empty contact.organization ? contact.organization.name : 'No organization'}
#{contact.get('Department') != null ? contact.get('Department').value : ''}
Context Variables
The variables available depend on where the EL is evaluated:
Available in Most Contexts
| Variable | Type | Description |
|---|---|---|
user |
UserAccount | The currently logged-in user (if any) |
account |
Account | Your DonorPoint account |
messages |
ResourceBundle | Externalized text for the current context |
commonRenderer |
CommonRenderer | Utility functions (formatting, HTML generation) |
queryService |
QueryService | Database query utilities |
elProcessor |
ELProcessor | Script execution utilities |
Available in Form / Transaction Contexts
| Variable | Type | Description |
|---|---|---|
purchaseOrder |
PurchaseOrder | The current transaction |
campaign |
Campaign | The current form/page |
contact |
Contact | The current constituent |
orderItem |
OrderItem | The current order item (in item-level scripts) |
Available in Email Contexts
| Variable | Type | Description |
|---|---|---|
contact |
Contact | The email recipient |
campaign |
Campaign | The associated form (if any) |
purchaseOrder |
PurchaseOrder | The associated transaction (if any) |
Useful CommonRenderer Functions
commonRenderer provides utility functions callable from EL:
#{commonRenderer.formatDate(purchaseOrder.orderReceived, 'MM/dd/yyyy')}
#{commonRenderer.formatAmount(purchaseOrder.amount)}
#{commonRenderer.substring(contact.firstName, 0, 10)}
#{commonRenderer.capitalize(contact.firstName)}
#{commonRenderer.eval('#{someOtherExpression}', 'varName', varValue)}
Accessing Custom Field Values
#{contact.get('FieldName').value}
#{purchaseOrder.get('OrderFieldName').value}
#{campaign.get('GL_CODE').value}
For Text Area (CLOB) fields use .text:
#{contact.get('Biography').text}
Always guard against null:
#{not empty contact.get('Department') ? contact.get('Department').value : ''}
QueryService — Database Queries
queryService allows querying the database from EL:
// EL in a script context — count prior gifts:
var count = queryService.createQuery(
"select count(po) from PurchaseOrder po where po.contact = :contact and po.status = 'ACTIVE'"
).setParameter('contact', contact).getSingleResult();
EL expressions embedded in JPQL query strings are automatically evaluated:
queryService.createQuery(
"select po from PurchaseOrder po where po.campaign = #{campaign} and po.status = 'ACTIVE'"
).getResultList()
Common Patterns
Conditional Field Visibility (Rendered Rule)
#{contact.get('EmploymentStatus') != null and contact.get('EmploymentStatus').value eq 'RETIRED'}
Context-Sensitive Label (Prompt Text)
#{not empty contact.getEmployer() ? 'Work Address' : 'Home Address'}
Personalized Email Greeting
Dear #{not empty contact.firstName ? contact.firstName : 'Friend'},
Amount Formatting
Your gift of #{commonRenderer.formatAmount(purchaseOrder.amount)} was received on #{commonRenderer.formatDate(purchaseOrder.orderReceived, 'MMMM d, yyyy')}.
Checking Prior Giving
#{not empty contact.activePurchaseOrders ? 'Welcome back! Your previous gift was appreciated.' : 'Thank you for your first gift!'}
JSF EL Reference
For the full EL specification:
Oracle Java EE 7 Tutorial — Expression Language
For DonorPoint-specific API:
DonorPoint API Reference