Can you make a list collector in record producer display like a list?

ritaaudi
Tera Contributor

Hi: A list collector in a record producer displays like this:

find_real_file.png

This takes up a lot of unnecessary space. Is it possible to make it display like a watch list in the tool as such:

find_real_file.png

Thank you, Rita

1 ACCEPTED SOLUTION

Hi Rita,



The width of the variable can be set via using DOM. For this you need to write an onLoad Catalog Client Script on the catalog Item as of below:


function onLoad() {


  //Get the Variable' Element ID by using Inspect Element on the Catalog Item or by pressing F12


  var el = document.getElementById('variable_IO:b437883b6fe63200f9ac52b10b3ee45e');


  el.style.width= '350px';


}



You can find the Variable ID by using inspecting element. Please find below how I have got the variable's Element ID.


find_real_file.png



Once You are done with the Scripting, it would look like below:


find_real_file.png



And my bad for my last response on the 'i' icon. For variable of glide_list type, there is no 'i' icon available.



I hope this helps.Please mark correct/helpful based on impact


View solution in original post

11 REPLIES 11

snehabinani26
Tera Guru

HI Rita,



Unfortunately this is how List collector is displayed in record producer and catalog item. We cannot bring the same as we have in Form level.



http://wiki.servicenow.com/index.php?title=Variable_Types#gsc.tab=0



Refer Section 10


sachin_namjoshi
Kilo Patron
Kilo Patron

Yes, You can achieve this.



Create a variable of type "Macro with Label" and select "macro_watch_list" as the macro.   That will get you what you are looking for.



Also, you may run into some other UI/scripting limitations there depending on what you need to do.   My preference is to use the standard list collector but adjust the size so that it isn't so huge.   This SNGuru link shows how to do this and it might be a good alternative to consider.



http://www.servicenowguru.com/scripting/client-scripts-scripting/change-size-list-collector-slushbuc...



Regards,


Sachin


amlanpal
Kilo Sage

Hi Rita,



YES you can achieve this. For this you need to have instance at least of Helsinki version. You need to add glide_list in the 'Variable Attribute' under 'Default value' tab in your 'List Collector' type variable. Please check Variable attributes .


find_real_file.png



I hope this helps.Please mark correct/helpful based on impact


shaik_irfan
Tera Guru

Rita,



Please write a OnLoad Client Script:



function onLoad(){


      var varName = 'Your_List Collector_Variable_Name';


      var height = '100'; //Optional


      var width = '250'; //Optional


      try{


              //Get the left and right bucket input elements


              var leftBucket = $(varName + '_select_0');


              var rightBucket = $(varName + '_select_1');


             


              //If the element exists


              if(leftBucket){


                      //Adjust the bucket height (default is 300px)


                      if(height){


                              leftBucket.style.height = height + 'px';


                              rightBucket.style.height = height + 'px';


                      }


                     


                      if(width){


                              //Adjust the bucket width (default is 340px)


                              leftBucket.style.width = width + 'px';


                              rightBucket.style.width = width + 'px';


                                                              //Fix Fuji/Geneva width issue


                                                              leftBucket.up('.slushbucket').style.width = width*2 + 100 + 'px';


                      }


                     


                      //Fix the expanding item preview issue


                      $(varName + 'recordpreview').up('td').setAttribute('colSpan', '3');


              }


      }catch(e){}


}



I hope this helps.Please mark correct/helpful based on impact




Regards,


Shaik Irfan