- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2015 02:11 AM
Hello,
I'm having trouble to get working a showfieldmesage in a catalog client script. I need to show an alert when a user is selected. This part is ok, but I need the message to include the name of a field. I'm trying to use getmessage() with an option and this is not working.
There is the code of the catalog client script :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if(newValue==''){
g_form.hideFieldMsg('user_ref');
return;
}
g_form.hideFieldMsg('user_ref');
var selected = g_form.getReference('user_ref', setUserMessage);
function setUserMessage(usr){
if(usr.u_pick_up_group!=""){
var pk = new GlideRecord('u_cmn_pick_up_group');
pk.get(usr.u_pick_up_group);
var msgg = getMessage("This user is already in {0} call pick up group, it will be deleted from the former one and associated with the selected one.",pk.u_name);
g_form.showFieldMsg("user_ref",msgg,"error");
}else{
g_form.hideFieldMsg("user_ref");
}
}
}
This is the message stored in sys_ui_message :
key : This user is already in {0} call pick up group, it will be deleted from the former one and associated with the selected one.
message : This user is already in {0} call pick up group, it will be deleted from the former one and associated with the selected one.
The system only retuns : This user is already in {0} call pick up group, it will be deleted from the former one and associated with the selected one.
It didn't return the message with the value of pk.u_name instead of {0}. Do you have an idea to resolve this ?
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2015 02:20 AM
Hi regis,
getMessage(String) on client side uses only one parameter vs gs.getMessage(String, Object) that can use a second parameter.
Thanks and Regards,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2015 02:20 AM
Hi regis,
getMessage(String) on client side uses only one parameter vs gs.getMessage(String, Object) that can use a second parameter.
Thanks and Regards,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2015 02:25 AM
Hi regis,
u can directly build the message. why u are using getMessage.
for exp.
var msgg = "This user is already in "+ pk.u_name + "call pick up group, it will be deleted from the former one and associated with the selected
one.";
g_form.showFieldMsg("user_ref",msgg,"error");
*****mark helpful/correct/like if it helps
Regards,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2015 02:28 AM
Hello Rushit,
I need a message to localize it depending the language of the connected user.
In your first message, this is probably why it doesn't work.