How can I re-size a list collector variable in record producer?

samuelscott
Tera Expert

I have a list collector variable named "supplier". I want to accomplish 2 things...

 

1) Make the list collector buckets smaller.

2) Have preselected options. I have managed to obtain pre-selected values due to preiously filled variable values, however they are placed on the left bucket, meaning they are not selected.

 

For point #1 I've used a script (catalog client script) that is referenced several times in the community, however, the community discussions are around 6-8 years ago...this is the script:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function onLoad(){

    var varName = 'supplier';

    var height = '100'; //Optional 100

    var width = '250'; //Optional 250

 

    try{

alert("left bucket exists 7");

        //Get the left and right bucket input elements

        var leftBucket = $('supplier_select_0');

alert("left bucket exists 10");

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

        

        //If the element exists

alert("left bucket exists 13");

        if(leftBucket){

alert("left bucket exists");

            //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){}

}

 

--------------------------------------------------------------------------------------------------------------------------------------------

For point #2 I haven't really tried anything, first of all, I'd like to know if its possible.

 

 

THANKS!!!!

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Samuel,

one thing you can do is add those variables in 2 column format

also check below links

https://www.servicenowguru.com/scripting/client-scripts-scripting/change-size-list-collector-slushbu...

https://community.servicenow.com/community?id=community_question&sys_id=3a178fe5db1cdbc01dcaf3231f96...

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you for your response Ankur...the first link you shared is where I got the script from, however, as I mentioned, it is not working for me. I believe the 2nd link shares the same script as well. Those links were created a pretty long time ago...

 

Also, what do you mean with 2 column format?

 

Thanks again!

Hi Samuel,

you can arrange the variables in either single column format or 2 column format

https://docs.servicenow.com/bundle/london-it-service-management/page/product/service-catalog-management/concept/c_DefineVariableSetLayout.html

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ok, I think I understand what you mean...but how does that fix any of my issues? I can't see the relation...

 

Thanks!