- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 02:25 AM
Hi,
So the requirement is that when an incident changes priority to critical, a warning message comes up and it needs to have a clickable link which leads to a knowledge article. I have made a client script for this but not sure how I can add the url to the Knowledge article. What am I doing wrong here? If I remove the var url alltogether than everything works fine. If I add it before the if statement it still does not work.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 1) {
var url = <a href = "https://lbg.service-now.com/it_lbg?id=kb_article&sysparm_article=KB0078495"> KB0078495 - critical incident guidance </a>
var res = confirm("Warning! Creating an incident with critical priority will automatically start the major incident process. Truly critical incidents are extremely rare so please ensure you fully understand the implications before submitting an incident with that priority. See" + url);
if (res == true) {
return true;
} else {
//g_form.setValue('priority',oldValue);
g_form.setValue('impact', g_scratchpad.impact);
g_form.setValue('urgency', g_scratchpad.urgency);
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2023 08:31 AM - edited ‎10-18-2023 08:55 AM
Hi,
Hello, we have some problems using & because the code understands that you will write some Unicode like < and unfortunately, we couldn't get around it.
To redirect to an article you can use the link '/kb_view.do?sys_kb_id=c85cd2519f77230088aebde8132e70c2'
It will redirect on the platform and not on the portal
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == '1') {
var text = "Warning! Creating an incident with critical priority will automatically start the major incident process. Truly critical incidents are extremely rare so please ensure you fully understand the implications before submitting an incident with that priority. See   <a href='/kb_view.do?kb_article=KB99999999 ' target='_blank' > KB99999999 - Microsoft Outlook Issues </a>";
var gm = new GlideModal ("glide_confirm_basic", true, 600);
gm.setTitle("Test title");
gm.setPreference("title", text);
/* gm.setPreference("onPromptComplete", function() {
alert("You clicked on 'Ok'")
});*/
gm.setPreference("onPromptCancel", function() {
//alert("You clicked on 'Ok'")
g_form.setValue('impact', g_scratchpad.impact);
g_form.setValue('urgency', g_scratchpad.urgency);
});
gm.render();
};
}
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2023 06:51 AM
Thanks, that has worked! Just one final thing. The link to the article does not actually open the article. It gives an error and I think its because you changed & to %26 in the link before the sys_parm. Why did you do that?
When I changed it back to & in the link then when I try to set the incident to critical, I get a pop up error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2023 08:31 AM - edited ‎10-18-2023 08:55 AM
Hi,
Hello, we have some problems using & because the code understands that you will write some Unicode like < and unfortunately, we couldn't get around it.
To redirect to an article you can use the link '/kb_view.do?sys_kb_id=c85cd2519f77230088aebde8132e70c2'
It will redirect on the platform and not on the portal
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == '1') {
var text = "Warning! Creating an incident with critical priority will automatically start the major incident process. Truly critical incidents are extremely rare so please ensure you fully understand the implications before submitting an incident with that priority. See   <a href='/kb_view.do?kb_article=KB99999999 ' target='_blank' > KB99999999 - Microsoft Outlook Issues </a>";
var gm = new GlideModal ("glide_confirm_basic", true, 600);
gm.setTitle("Test title");
gm.setPreference("title", text);
/* gm.setPreference("onPromptComplete", function() {
alert("You clicked on 'Ok'")
});*/
gm.setPreference("onPromptCancel", function() {
//alert("You clicked on 'Ok'")
g_form.setValue('impact', g_scratchpad.impact);
g_form.setValue('urgency', g_scratchpad.urgency);
});
gm.render();
};
}
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2023 06:49 AM
Thanks so much for all your help!