adriantan08
Giga Expert

Hi, Guys. In case you stumble upon a requirement to set multiple pre-populated values in a multiple-enabled sn-record-picker, you can do this by assigning comma-separated values for both the field's value and displayValue.

Suppose I have this HTML code:

this record picker's selectable values are being updated dynamically based on a hypothetical value taken from c.manager_id

<sn-record-picker 
    field="c.employees" 
    multiple="true" 
    table="'u_employees'" 
    display-field="'u_fullname'" 
    value-field="'sys_id'" 
    search-fields="'u_fullname'" 
    page-size="40" 
    size = "60" 
    default-query="'manager_id='+c.manager_id"> 


</sn-record-picker>

In you Client Script, you can do the following:

c.employees.value = "sys_id2, syd_id2";

c.employees.displayValue = "display-field1, display-field2";

 

I figured sharing this as I wasn't able to find a good reference and stumbled upon a split() error seen through the console when i initially though that the .value and .displayValue would need an array. 

 

Comments
Yaraslau
Tera Guru

Also for displayValue you should use TOKENIZER ####

c.employees.displayValue = "display-field1####display-field2";
Version history
Last update:
‎09-25-2018 08:59 PM
Updated by: