Multiselect picklist - How do we access label ?

I have created custom renderer to display a dynamic values in a multiselect picklist ui only field.

params.options.type = “CHECKBOXES”;   
params.options.type = “CUSTOM”;    
picklistEntries = [];
picklistEntries.push({ value: ‘0’, label: ‘AAA’, defaultValue: false, active: true });
picklistEntries.push({ value: ‘1’, label: ‘BBB’, defaultValue: false, active: true });
picklistEntries.push({ value: ‘2’, label: ‘CCC’, defaultValue: false, active: true });
params.metadata.picklistEntries = picklistEntries;

skuid.ui.fieldRenderers.MULTIPICKLIST.edit(params,value);

Now at some point if i need to access the label (AAA, BBB…) for this field, how can this be achieved as accessing the field is always returning the value.

The metadata label for the database Field itself is available through field.metadata.label

Zach, The requirement is to get the label,value pair of the multiselect picklist. I am able to get the value by using the field api directly but to access the label of label,value pair is something which is required.

Hi Vivek,

There are two ways I know of to get that metadata.
Either way you would have to check what data has been selected and match them with the metadata (since its a multipicklist you need to split the values by “;”).

1: You could add a change listener on the field (params.element) and access the picklist entries using “params.metadata.picklistEntries” (you can do that in the same snippet as your field renderer)
2: You could also access the metadata (in another snippet) using “model.fields[x].picklistEntries” where “model” is your model and “x” is the index of the field in the fields array

Cheers