- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 07:52 AM
I am trying to create a client script to display a system message based on the users language.
(This is a small part of what I am trying to do, but after failing for 20 hours; I am trying small bites.)
This is the code I am using:
function onLoad() {
var language = g_user.getLanguage();
g_form.addInfoMessage(language);
}
I have also tried variations using
var loginLanguage = g_user.getClientData("loginlanguage");
With correct variables set,,,
And GlideAjax...
Thanks for your time,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 11:00 AM
as per my understanding it is acting like this way just because of we are dealing in different scope. when you will try the same thing in global then it will work perfectly.
may i know your exact requirement?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 09:11 AM
can you please share your script? i tested my above script and it has returned result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 09:26 AM
Client Script:
function onLoad() {
//Type appropriate comment here, and begin script below
alert(g_scratchpad.check);
}
Business Rule:
(function executeRule(current, previous /null when async/) {
// Add your code here
g_scratchpad.check= gs.getUser().getLanguage();
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 10:26 AM
ohh you are in scoped application that's why. g_scratchpad behave abnormal in scoped application .
by the way let's make it more simple.
can you try to only use g_lang variable in you client script.
eg:
function onLoad() {
//Type appropriate comment here, and begin script below
alert('My Language is: '+g_lang);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 10:53 AM
This works!
I was wondering what is up with g_scratchpad; I could get a return of text & math (functions) but not user (tried userName, ID, etc.) or session data.
Now I just have to figure out how to use this to show and hide fields using this g_form.setDisplay and an if / else statement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017 11:00 AM
as per my understanding it is acting like this way just because of we are dealing in different scope. when you will try the same thing in global then it will work perfectly.
may i know your exact requirement?