What are Slushbucket methods in script?

peter_repan
Tera Guru

Hi all,

I miss documentation to Slushbucket. I have macro with <g:ui_slushbucket/> element and I would like to know available methods for slushbucket.

I found a method addLeftChoice() or clear() or getRightSelect() but I miss method for adding right choices.

Could you please point me to some documentation or show me some next methods?

Thanks!

21 REPLIES 21

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I'm not aware of any wiki documentation that lists methods for working with a slushbucket/list collector. The best resource for scripting help to manipulate a list collector is the following list of sncguru articles.


http://www.servicenowguru.com/tag/list-collector/


Anthony_vickery
Tera Expert

Unfortunately, there is no AddRightChoice function directly available. I created a custom client script function for my custom UI Page using the following:


function addRightChoice(value, text){


      var opt = cel('option');


      opt.value = value;


      opt.text = text;


      slush.getRightSelect().options.add(opt);


}



Although you can't directly get to the documentation, you can iterate through a SlushBucket object to find its methods and properties:


var sb = new SlushBucket();




for(var i in sb){


      alert(i + '\n' +sb[i])


}


This is a handy trick, but you can't cut-n-paste from the alert window. I prefer to spew the properties and functions into the console log:


var sb = new SlushBucket();


var mess = '';



for(var i in sb){


      mess = mess + '\n' + i + '\n' +sb[i];


}


console.log(mess);


Thank you so much. I've been searching and searching for what methods I could use with SlushBucket and this is the only thing I've found! Helped me to get what I needed. Why ServiceNow doesn't actually publish this information I don't know.