Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Jelly expression is erroneously executed as JEXL if it contains the string "ref" - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Jelly expression is erroneously executed as JEXL if it contains the string "ref"
KB0610452

Jelly expression is erroneously executed as JEXL if it contains the string "ref"


1235 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Description

The system determines whether to run certain Jelly expressions using JEXL or Rhino. If a table includes the string "ref," the wrong engine may be used and cause incorrect output.

Steps to Reproduce

  1. In the Application navigator, type sys_user_preference_list.do in the Filter navigator field and press enter or return on your keyboard.
  2. Open a record.
  3. Add the activity stream to the form.
  4. Click Update.
    Note that the activity stream does not load any data. This is caused by the use of a phase 1 ${} expression inside of a phase 2 $[] expression. Jelly determines if a $[] expression is evaluated as a JEXL expression or a Rhino expression. For example:



    Normally, the above expression is evaluated as a Rhino expression, which is what is intended. However, because sys_user_preference contains the substring “ref,” which has special meaning in Jelly, the expression is evaluated as a JEXL expression on that table. This causes the expression to evaluate incorrectly because the sys_user_preference GlideRecord variable is not defined in the JEXL variables; it is only defined in the Rhino context. This causes the expression to evaluate as “!null && null && !false.” Because null= false in JEXL, the expression is false.

Workaround

A possible workaround is to rename the table so it does not contain “ref.” However, it is strongly recommended that you avoid the pattern $[${}]. To ensure that the expression evaluates as JavaScript to avoid this issue, replace the $[] with a g2:evaluate.


Related Problem: PRB742414

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.