Display message within a catalog item after it has loaded
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2018 02:01 PM
After a catalog item has loaded, I would like a simple info message displayed at the top of each one. Think of it as a global message for all catalog items. Since most of our catalog items contain a common variable set, I figured I could simply create and tie a catalog client script to this common variable set. That said, I created the following catalog client script:
Applies to: A Variable Set
Variable set: My variable set selected (and verified multiple times)
Type: onLoad()
Active: checked
UI Type: All (also tried using Desktop)
Applies on a Catalog Item view: checked
Order: 9999
Script:
function onLoad() {
g_form.addInfoMessage("Info message here");
alert("Alert here");
}
When I load a catalog item containing the variable set, the alert pops up, but no info message is displayed. I also switched them around and received the same results.
Also, there is another 'onLoad()' script within the same variable set, but it does not contain 'g_form.clearMessages()' or the like. I also set this script (order) to run last (e.g. 9999).
Is this a limitation of the system or one of those issues in which I'm simply overlooking something?
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2018 08:51 PM
So this works for me OOB on my Personal developer instance;
I'd do the following;
1. Enusre there's no errors in your browsers console(f12) if you are getting an error in a client script before this client script gets run, this will fail to run.
2. Ensure this is a a "Catalog Client Script" I'm pretty sure it is but thats another option.
3. Still not working, try to recreate this on a new item, or on a personal developer instance.
Here's the code I used;
And here's what it did;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2018 09:02 AM
Hi Jace,
Thanks for response. In your example, you have tied the script to a catalog item. This works correctly, but only for that specific catalog item.
My example ties the script to a variable set (exists within most of my catalog items), but fails to produce a info message (js alert works). Again, not sure if I'm overlooking something, or just a limitation of the tool.
- Leo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2018 12:21 PM
I moved my client script to a new variable set, and associated the variable set to the item and it still works for me in both places.