Picklist entries custom renderer not working

Does anyone see anything wrong with this?
Renderer isn’t working. No console errors other than ‘Refused to set unsafe header agent’

Seems like somehow the field metadata isn’t getting overwritten? I’m just getting the standard values for the picklist. I’ve watched the rendering in the console, and the picklistEntries array is definitely getting populated with the right values.

'renderPRLLists': function(field,value){ value = skuid.utils.decodeHTML(value);<br>var listModel = skuid.$M('CreatePRL_Lists'),<br>picklistEntries = [];<br>$.each(listModel.getRows(),function(i,row) {<br>picklistEntries.push(<br> &nbsp; &nbsp; &nbsp; &nbsp;{ value: row.Name, label: row.Name, defaultValue: false, active: true }<br>);<br>}); &nbsp;<br>field.metadata.picklistEntries = picklistEntries;<br>skuid.ui.fieldRenderers.MULTIPICKLIST.edit(field,value);<br>field.model.updateRow(field.row, field.id, value, {initiatorId: field._GUID});<br>}

Hey Matt -

A few things:

1) I’m assuming you’ve done this, but have you debugged to make sure that the renderer is getting called and inspected the metadata.picklistEntries before/after establishing the new value?

2) Is there a reason you are calling updateRow in the last line?  The value of the field should already be set by the time the renderer is called so I’m not seeing a reason that you need to update the field value?

3) What version of Skuid are you running?

4) Can you try changing the code to use a hardcoded list of values instead of from a model just to rule out a ‘data’ issue with the model data itself?  For example:

var picklistEntries = []; picklistEntries&#46;push({ value: '0', label: 'AAA', defaultValue: false, active: true });<br />picklistEntries&#46;push({ value: '1', label: 'BBB', defaultValue: false, active: true });<br />picklistEntries&#46;push({ value: '2', label: 'CCC', defaultValue: false, active: true });<br />field&#46;metadata&#46;picklistEntries = picklistEntries;

Good ideas, Barry.
1) Yes.
2) No idea what I was thinking there.
3). 8.10
4)  I’ll do some more digging.

Sounds good Matt, just lemme know.  Btw, I threw together a quick sample with 8.10 and it’s working as expected for me so there is hope :slight_smile:

The crazy thing is, it’s running just fine in our dev org. But it’s not working in production. Any thoughts on what the difference might be? The only difference in the code is that I ran it through uglify.

That is rather strange.  Couple of questions/thoughts:

1) 8.10 in both Dev & Prod?
2) Dev is Summer '16 or Spring '16?  If Dev is Summer '16, do you you have a Spring '16 SBX that you can test against? 
3) For some reason, I remember seeing a thread a while back where Zach mentioned something about overriding picklist values and it not respecting the change and there was a reason.  Unfortunately, I can’t remember the reason nor can I find the thread right now.  I might be remembering incorrectly but for some reason, that memory is sticking out in my head right now. 

Zach - Any thoughts?  Maybe I’m not remembering correctly?

Are there record types or picklist dependencies that are different in the two orgs? Skuid applies extra logic for picklists that have record type dependencies and may be throwing out your changes. I can’t dive into the code on this right now, but it might be worth checking.

Ah, that’s right. Thanks, Ben & Barry. I think we have some legacy record types in production that I need to remove. They’re probably at fault.

Thanks Ben, that’s what I remember seeing!