Catalog client script problem using getMessage for Service Portal

kuarq
Mega Contributor

Hello,

I have an onSubmit Catalog client script and within I'm using an alert and the getMessage to automatically get a message key for translation purpose. The script has to work on all interfaces (UI type = ALL).

On the Service Portal the problem I have is that the first time the alert pops, the message key and not the actual message. On the second attempt, then the actual message is displayed.

find_real_file.png

find_real_file.png

 

I found some posts regarding this problem but it was for Helsinki and we are on New York.

Here is the code portion I'm using to get the message

var passed = forceMandatoryCheckboxes(mandatoryVars, mandatoryCount);
    if(!passed){
        //Abort the submit
        alert(getMessage('select_location_access_card'));
        return false;

 

Is this still a bug or maybe I'm not using the correct code for the Portal?

Thank you

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

I've also described this a few months ago in this article:
Catalog Client Script Messages (Internationalization/Multi-Language)

If my answer helped you in any way, please then mark it as helpful.

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

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did you add the message to the message field? Out-of-the-box the message field is not on the form lay-out of Catalog Client Scripts.

If my answer helped you in any way, please then mark it as helpful.

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

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hello,

I tried your solution. I added the 'Messages, field on the form and inside I typed my message key.

It works fin but only when I'm in English. If I try it in French I have the same problem, the first time the alert pops it displays the message key.

I also tried another solution using the callback function and same result, English works but not French.

Thank you

Can you share exactly what you've set up? Catalog Client Script + UI Messages).

Asking this because we use a multi-language instance also (English and Dutch), and this works fine.

If my answer helped you in any way, please then mark it as helpful.

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

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn