- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2019 07:47 AM
Most all of our Service Requests use 2 standard Variable Sets and each of those Variable Sets have a Label that we modify the background color, font, alignment, etc. These are still working just fine. This the code from one of those:
function onLoad() {
// Get the sys_id of the label field
var label1 = 'u_summary_label1';
var gr = new GlideRecord('item_option_new');
gr.addQuery('name', label1);
gr.query();
var sysID = '';
while (gr.next()) {
//alert('sys_id: ' + gr.sys_id);
sysID = gr.sys_id;
}
// Create the string for the label field
var str1 = "IO:" + sysID;
var str2 = "label[for='" + str1 + "']";
var text = $j(str2); //top label color set
text.css('background-color','blue');
text.css('width','100%');
text.css('color','white');
text.css('text-align','center');
text.css('font-size','18px');
}
Once these variable sets are presented, the last section is customized based on what the SR is for, and we use this same code to modify the label for that section. This all still works. However, I'm writing a new Catalog Item and want to use the same Catalog Client Script code to modify the label, but when I run it, the label isn't changed. In the console log I see this error. The sys_id is the id for my Catalog Client Script.
TypeError: $j is not a function
at onLoad_e3ed12211b322f841b368738cd4bcb1c (com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=e0675edd1b76ab841b368738cd4bcbaa:752)
at com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=e0675edd1b76ab841b368738cd4bcbaa:765
at js_includes_doctype.jsx?v=11-11-2018_0542&lp=Sun_Dec_02_09_09_46_PST_2018&c=11_116:485
at runBeforeRender (js_includes_doctype.jsx?v=11-11-2018_0542&lp=Sun_Dec_02_09_09_46_PST_2018&c=11_116:402)
at z_last_include.jsx?v=11-11-2018_0542:32
at z_last_include.jsx?v=11-11-2018_0542:38
We recently upgraded to London in all environments and can't understand why legacy code works but new doesn't.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2019 09:04 AM
With london version, ServiceNow has introduced "Isolate script" field on client side scripts. If need to set the flag of this field to false to allow DOM. Remember, older scripts works as is, but for new scripts, this flag gets sets so that DOM should not be performed in client side code. Once you set the field value for your catalog client script, you should be fine 🙂
Below is associated knowledge article
https://hi.service-now.com/kb_view.do?sysparm_article=KB0694479
Note: Please mark reply as correct / helpful if it has answered your question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2019 09:04 AM
With london version, ServiceNow has introduced "Isolate script" field on client side scripts. If need to set the flag of this field to false to allow DOM. Remember, older scripts works as is, but for new scripts, this flag gets sets so that DOM should not be performed in client side code. Once you set the field value for your catalog client script, you should be fine 🙂
Below is associated knowledge article
https://hi.service-now.com/kb_view.do?sysparm_article=KB0694479
Note: Please mark reply as correct / helpful if it has answered your question