Adding a URL link within an onSubmit Catalog Client Script

matthew_hughes
Kilo Sage

I've got a catalogue item where an alert message appears when certain options are selected. I've created an OnSubmit Catalog Client Script for this and applied the following code:

 

function onSubmit() {
//Type appropriate comment here, and begin script below
var rhsCategory = g_form.getValue('target_state_rhs_category');
var rhsSubCategory = g_form.getValue('target_state_rhs_sub_category');
var rhsStrategicStatus = g_form.getValue('u_strategic_status');
var link ='<strong><a href="https://lbg.service-now.com/kb_view.do?sysparm_article=KB0074291" target="_blank">KB0074291</a></strong>';

if (rhsCategory == 'Reimagine' && rhsSubCategory == 'Replace') {
return confirm ("The combination for RHS Category/RHS Sub - Category you have selected does not align with the selected Strategic Status. Please review your selection for strategic status and RHS. See Toxic Combinations List in " + link + " for conflicting RHS and Strategic Status combinations.");
}

if (rhsCategory == 'Hold' && rhsSubCategory == 'Strategic') {
return confirm ("The combination for RHS Category/RHS Sub - Category you have selected does not align with the selected Strategic Status. Please review your selection for strategic status and RHS. See Toxic Combinations List in " + link + " for conflicting RHS and Strategic Status combinations.");
}
}

 

I'm wanting the alert to show KB0074291 as the link and to open in a new windows. However, when a user clicks submit if those two conditions are met, the it displays the following:

 

OnSubmit pop up.png

I was just wondering what I need to do to stop the html from showing. Also, how do I replace the title 'lbgdev.service-now.com says' to something more appropriate?

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Hi Matthew,

 

You need to follow the UI Page route. Please check link once.

That example you sent is for an onChange client script. Mine is onSubmit