Discussion
Pegasystems Inc.
JP
Last activity: 13 Dec 2021 7:51 EST
Unable to log in to the system after inserting a line break in Field Value
Hi,
Customer reported that they can't log in to the system after developer inserted a line break in a Field Value rule. In this post, I am sharing what the issue is, and how to fix it.
- Requirement
Customer wanted to insert a line break in the pop up alert message that is displayed when user tries to proceed to the next screen without entering value for a required field.
Below is the out-of-the-box pop up alert message that comes with Japanese language pack. There is no line break by default.
- Issue
Customer identified a Field Value rule for the alert message and inserted a line break by just [Enter] without using special characters as below.
Right after this customization, entire users became unable to log in to the system. When user logs in, blank page is displayed as below. This issue is replicated both in Developer portal and Manager / User portal.
- Root cause
There are no errors logged in the PegaRULES log file, but if you turn on browser's Developer Tools, you should be able to see "Uncaught Syntax Error: Invalid or unexpected token" error as below. This is the one that is actually preventing all users from logging in.
But you may wonder, this alert message is used when user is working on screen. What does it have to do with logging in? Per our research, we figured out that when user logs in, system runs below JavaScript (@baseclass.pzClientLocaleData) to look up Field Value and set the string to a variable.
As you can see in above script, there are many Field Value rules that are read when user logs in. Below are some of the examples, but there are many others.
- "Invalid input - reenter a decimal number greater than 0"
- "Enter a non-negative number"
- "Invalid input - enter a number between 0 and 100"
- "Enter a valid email address"
- "Enter a valid phone number"
- "Enter a valid future date"
- "Enter a valid past date"
- "Enter a valid alphabetic value"
- "Enter a valid alphabetic or numeric value"
- "The value specified is not matching with the format"
- "Enter a valid Alphanumeric or space Value"
- "Please correct flagged fields before submitting the form!"
...
- Solution
In JavaScript, you need to use "\n" for a line break as below.
- Notes
Be noted, this backslash + n syntax must be used only when the field value is directly used in JavaScript. If the field value is used in HTML, <br> must be used instead.
Hope this helps.
Thanks,