The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mark Roethof
Tera Patron
Tera Patron

Hi there,

A while ago I wrote an article on Internationalization on Client Side scripting. It concerned applying UI Messages within (Catalog) Client Scripts: Catalog Client Script Messages (Internationalization/Multi-Language).
A colleague recently thought "let's apply UI Messages within a Catalog UI Policy". Somehow… exactly what described in my article on (Catalog) Client Scripts appeared: When the UI Message is triggered for the first time, the actual Message is not retrieved. The key (as scripted) is displayed instead. After some investigation: there's no fix for this, though I did come up with a small workaround.


Applying UI Messages

Following my article on Catalog Client Script Messages (Internationalization/Multi-Language), one would first add a UI Message record [sys_ui_message], and add the key of the UI Message to the Messages field. On (Catalog) Client Scripts, out-of-the-box this field is hidden and simply could be added to the form layout. On (Catalog) UI Policies, there is no Messages field so we have to skip this step.

find_real_file.png

find_real_file.png

Note: Be sure to set the Run scripts in UI type of the Catalog UI Policy to All.

Triggering the Catalog UI Policy

In the example below we are triggering a Catalog UI Policy through entering a date in the past (read about No code date validations in one of my articles: No Code date validations through (Catalog) UI Policies).

Unfortunately though, when the UI Message is triggered for the first time, the actual Message is not retrieved. The key (as scripted) is displayed instead.

find_real_file.png

When we simply trigger the Catalog UI Policy again, without reloading the browser, the Messages is shown correct.

find_real_file.png


Workaround

The situation described above is exactly what is described in Catalog Client Script Messages (Internationalization/Multi-Language). Adding the key of the UI Message to the Messages field fixed this issue. As mentioned already, on (Catalog) UI Policies there is actually no Messages field.

After some investigation I came up with a small workaround:
1) Creating an onLoad Catalog Client Script which contains the UI Message key in the Messages field.

find_real_file.png

Using the Messages field is the only purpose for the onLoad Catalog Client Script.

Note: Be sure to set the UI Type of the Catalog Client Script to All.


Result

When opening the Catalog Item once more and triggering the Catalog UI Policy, note the Message is instantly displayed correctly!

find_real_file.png

Note: This applies to both UI Policies as Catalog UI Policies.

---


And that's it actually. If any questions or remarks, let me know!

👍
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful.

Interested in more articles, blogs, videos, and Share projects on General / Platform I published?
General / Platform


Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn

 

Version history
Last update:
‎06-14-2020 10:04 PM
Updated by: