Skip to main content

I need to remove a picklist value from a perticular field on a row while they do an edit in table  i.e I don’t want to show “Closed Own” Picklist value on stage field . i tried this from what i have learnt.



var field = argumentsg0];

value = skuid.utils.decodeHTML(argumentsg1]);

oppModel = skuid.model.getModel(‘OpportunityList’);

if (field.mode == ‘edit’) {

     var picklistEntries = field.metadata.picklistEntries;
   
    console.log(picklistEntries);

    for( var x in picklistEntries){

        console.log(picklistEntries x].value);

        if(picklistEntries/x].value === ‘Closed Own’ ){

            console.log(picklistEntries.length);

            picklistEntries.splice(x , 1);

            console.log(picklistEntries.length);

        }

    }

}

skuid.ui.fieldRenderersbfield.metadata.displaytype]field.mode;


*********

i was able to remove it form picklistEntries , but i am not sure how to update the field with these new List.

Just for Info:
I have a row Action Button with multi action button which updates the Stage to “Closed Own” and at same time Shows a pop-up to enter values in those fields. I don’t want users to update stage value to “Closed Own” directly from stage field. 

thanks in advance…


Chandu,

Have you read this? https://community.skuid.com/t/how-do-i-render-custom-picklist-values

Moshe’s question and its answer near the bottom of the thread may be helpful.


Hi Matt,

Thanks for your suggestion , but I have already Checked it…

In the above snippet ,I am able to remove the picklist value from the Picklist field( reflected in the console) , but was not reflecting on the UI.




If the values are right in the model but not in the UI, you have a rendering problem. Not sure why skuid.ui.fieldRenderers would not be rendering correctly, but you could try forcibly rendering your component to test it:

skuid.component.getComponentById(‘MyComponentId’).render();

NOTE: I haven’t examined your code thoroughly. Not sure what’s going on there with the while loop and splicing. I’m just trusting that you’re correctly removing the entry you don’t want.


Hi Matt,

Apologize for delayed reply

we have ignored the above requirement and for my personal learning, Is there a way to do that , as the above code which i am referring is not working.

thanks in advance…



Chandu,

I’m sorry, I’m not sure what you’re asking.

If you’re running Banzai and you want to remove the picklist value for the model, you could try to overwrite the field’s metatdata.

If you want to use javascript to remove the value of a picklist, use the code from Moshe here: https://community.skuid.com/t/how-do-i-render-custom-picklist-values