Picklist renderer (Push) How do you indicate what picklist to control?

  • 1
  • Question
  • Updated 2 years ago

Hi everyone, So I was looking into Pats thread from some time back and seeing his snippet. Im applying this to a table with different pick list fields.

My question is - How do I point out what picklist to modify and push values to?

Sorry I know this is a highy posted topic, I visited many other posts on this but was not able to narrow down the answer.

Thanks in Advance!

Attached its Pats final code for reference;


var field = arguments[0],
    value = skuid.utils.decodeHTML(arguments[1]);
    userModel = skuid.model.getModel('User'),
    userRow = userModel.getFirstRow(),
    userRole = userModel.getFieldValue(userRow,'Contact.Current_Role__c'),
    isTeacher = (userRole == 'Teacher'),
    grpModel = skuid.model.getModel('Guided Reading Plan'),
    grpRow = grpModel.getFirstRow();

// Prevent teachers from making any edits if the status is approved by forcing the mode to read-only

if ((value === 'Reviewed & Approved') && isTeacher) {
    field.editable = false;
    field.mode = 'read';

if (field.mode == 'edit') {

    var picklistEntries = field.metadata.picklistEntries;
    picklistEntries.length = 0;     // if you don't do this, then the "real" values are already in the picklist and the code below will add duplicate values

    // if there is no record yet, add a default value. NOTE: when the page is saved, the grp model is only saved when the value in this field is not blank. I am NOT using the Skuid field property "Add 'None' Option" because I only want this option to appear when there isn't already a record.

    if (skuid.model.isNewId(grpRow.Id)) {


            { value: '', label: '-- Select a Status to Create --', defaultValue: false, active: true  }


    // create picklist values for the basic statuses

     { value: 'Working', label: 'Working', defaultValue: false, active: true  },

{ value: 'Ready for Review', label: 'Ready for Review', defaultValue: false, active: true }

    // create picklist values for the review/approval statuses if the user is not a teacher
 if (!isTeacher) {


   { value: 'Reviewed & Approved', label: 'Reviewed & Approved', defaultValue: false, active: true },

   { value: 'Reviewed & Needs Changes', label: 'Reviewed & Needs Changes', defaultValue: false, active: true }

// Run the standard picklist renderer for the given mode
Photo of jorge cortes

jorge cortes

  • 160 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Hi, Jorge,
You said you are working with a table component. Are you trying to figure out how to control:
  1. which picklist field on a single row to update (Example: the table has 3 picklist fields Field1__c, Field2__c, Field3__c; and you want to only update the picklist options for Field1__c), or
  2. which row in the model to update (Example: you have 10 rows in the table, and you want to dynamically generate different picklist values for the same field on different rows... perhaps based on a particular field value in the row)?
I'm just trying to get a better sense of what you're trying to accomplish, and where you are hitting an issue.