- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 06:57 AM
Hi Team ,
I have a requirement that whenever an enduser select a combination of values in Impact and urgency field in service portal,there should be an alert popup stating "This is a high priority issue and will be fixed asap " in bold red text.
For example if an enduser select "All users facing issue " in Impact and "Complete outage" in urgency field,then the above popup alert should appear in the portal.
Any idea how to achieve this?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 11:15 AM
You will need to create 2 catalog client scripts; one of them should run onChange of the urgency field, and one should run onChange of the impact field.
The script below will check the value of both fields and if they match the values in the script it will show the modal.
So copy the code below into the 2 catalog client scripts.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Get the value of impact and urgency
var impact = g_form.getValue('impact');
var urgency = g_form.getValue('urgency');
var html = '<font color="red" size="4"><p><strong>This is a high priority issue and will be fixed asap</p></strong></font>';
// If impact and urgency
if (impact == 'All users facing issue' && urgency == 'Complete outage') {
// Use spModal to pop the HTML
if (html) {
spModal.open({
title: 'Notice',
message: html,
buttons: [
{label:'OK', primary: true}
],
});
}
}
}
Hope this helps!
Thanks,
Dan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 08:56 AM
So you cannot style the color when using an alert but it does not matter because we can use the spModal instead.
Use this code in your catalog client scripts to display the modal.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var html = '<font color="red" size="4"><p><strong>This is a high priority issue and will be fixed asap</p></strong></font>';
// Use spModal to pop the HTML
if (html) {
spModal.open({
title: 'Notice',
message: html,
buttons: [
{label:'OK', primary: true}
],
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 10:48 AM
Hi Dan ,
I have tried the above script for alert popup in service portal but did not work as expected.
Because i am able to choose only one variable at a time for onchange.
The alert will only happen when both the variables impact and urgency changes at the same time.
How to fix this ?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 11:15 AM
You will need to create 2 catalog client scripts; one of them should run onChange of the urgency field, and one should run onChange of the impact field.
The script below will check the value of both fields and if they match the values in the script it will show the modal.
So copy the code below into the 2 catalog client scripts.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Get the value of impact and urgency
var impact = g_form.getValue('impact');
var urgency = g_form.getValue('urgency');
var html = '<font color="red" size="4"><p><strong>This is a high priority issue and will be fixed asap</p></strong></font>';
// If impact and urgency
if (impact == 'All users facing issue' && urgency == 'Complete outage') {
// Use spModal to pop the HTML
if (html) {
spModal.open({
title: 'Notice',
message: html,
buttons: [
{label:'OK', primary: true}
],
});
}
}
}
Hope this helps!
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 11:56 AM
Hi Dan,
One final query on the same issue that if i need to convert the alert "This is a high priority issue and will be fixed asap" into French so that french users wont see the english alert.
How would i achieve that?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 12:27 PM
You will need to use the sys_ui_message table.
In the messages table you will want to create 2 records with the same key value and then set the language fields to the different languages. The message field should contain the message in the language specified e.g. The Dutch message should have the message in Dutch.
In the catalog client scripts you will need to retrieve the message using the key you used for the message records.
var html = '<font color="red" size="4"><p><strong>' + getMessage('your key') + '</p></strong></font>';