Skip to main content

I’m trying to overcome Salesforce’s limit of 150 values for a multi-select picklist by creating a custom renderer that adds the additional values (the values I want to show in the multi-select picklist are values from another model). I think I’m close, but I can’t quite figure out what piece(s) are wrong.

My renderer currently looks like this:


var field = argumentsr0], value = argumentsr1], $ = skuid.$;<br>var codesModel = skuid.model.getModel('Codes'); //<br>var codes = c];<br>for(i = 0; i &lt; codesModel.data.length; i++) {<br>&nbsp; &nbsp; codes.push({<br>&nbsp; &nbsp; &nbsp; &nbsp; 'label': codesModel.datadi].Name&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; ,'value': codesModel.datadi].Name&nbsp;<br>&nbsp; &nbsp; });<br>}<br>field.element.append(<br>&nbsp; &nbsp; skuid.ui.renderers.MULTIPICKLIST.edit({<br>&nbsp; &nbsp; &nbsp; &nbsp; entries : codes<br>}));<br>return;<br>

This actually renders the field the way that I want, but it doesn’t appear to be connected to the model - when I select/unselect values in the dropdown, the save button is not enabled on the page. I think that this is because I’m using skuid.ui.renderers instead of skuid.ui.fieldRenderers, but I can’t find a way to specify the entries when using skuid.ui.fieldRenderers.

Any ideas on how I can make this work?

After digging through the skuid forums some more and tinkering with this for a while, I was finally able to get this working. I found a couple of similar posts asking about how to add custom values to standard picklists, and I was able to adapt it to work for multiselect picklist.

Here’s my final snippet - if anyone has suggestions on anything that could be improved, I’d love to hear your input.


var field = argumentse0], value = skuid.utils.decodeHTML(argumentse1]), $ = skuid.$; if (field.mode === 'edit') { var tourCodes = s]; skuid.$.each(skuid.model.getModel('TourCodes').getRows(), function(i,row) { tourCodes.push({ active: true ,defaultValue: false ,label : row.Name ,value : row.Name }); }); var customMultiselect = skuid.ui.renderers.MULTIPICKLIST.edit({ entries : tourCodes, required : false, value : value }).change(function(newValue) { var selectedOptions = ''; for(i = 0; i &lt; newValue.target.selectedOptions.length; i++) { selectedOptions += newValue.target.selectedOptionsii].value + ';'; } //Update the row in the target object field.model.updateRow(field.row, 'TourCodes__c', selectedOptions); }); //Append the MULTIPICKLIST to the DOM element field.element.append(customMultiselect); } else { //If the mode is anything other than edit, display the field as Text var formattedValue = ''; if(value !== null) { formattedValue = value.split(';').sort().join(', '); } skuid.ui.fieldRenderers.TEXT.read(field, formattedValue); }

Glad you were able to get this working Jonathan.