Re-sizing a reference variable width in the item and/or task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2015 01:52 PM
Hello,
I found an article on how to re-size a reference variable in the catalog item. Here is the link https://community.servicenow.com/thread/177647
Here is the code used
var myVar = $('sys_display.' + g_form.getControl('<variable name>').id); //Get the correct reference element
myVar.style.width = '350px'; //Set the width
It works well in the catalog item but it does not work in the item or task. I tried to change the name and tried a few other options that I found
g_form.getControl('variables.name').style.width = '350px';
for (var i = 0; i < g_sc_form.nameMap.length; i++) {
if (g_sc_form.nameMap[i].prettyName == '<variable name>') {
g_form.getControl(g_sc_form.nameMap[i].realName).style.width = '350px';
}
}
So far, no luck.
Any of you have some other ideas to get it to work in the item and task as well.
Thanks...Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2015 07:45 AM
Try using g_sc_form.getDisplayBox('....').style.width = '350px';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2016 08:44 AM
Hi Jimmy,
Have you found a solution to accomplish this? I'm trying to do the same and running into the same challenge.
Regards,
Johnny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2016 08:50 AM
Jimmy,
Create a catalog client script, for onload and make sure applies to catalog item, request item and catalog task are checked.
Try this code
g_form.getDisplayBox('<variable name>').style.width = '<whatever width>px';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2016 10:56 AM
Thanks Patrick. This code however does not work on the request item or task even if both of those checkboxes are checked on the catalog client script. It does however only work on the Catalog item. This is the same issue that the original post is referring to.
Thanks,
Johnny