
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 06:18 AM
I have a sn-choice-list as such:
Which shows me list of countries.
<sn-choice-list sn-model="c.cmp_country" id="cmp_country" name="cmp_country" placeholder="${Company Country}" field="country" sn-options="data.cnt" sn-value-field="value" sn-text-field="label" sn-items="data.cnt" page-size="10" required></sn-choice-list>
How to i fetch the value selected in server script ?
Solved! Go to Solution.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 11:32 PM
Change it as below, and add ".toString()" while getting the value from a GlideRecord [cnt.sys_id.toString()].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 10:12 PM
Have you tried seeing the value of the object using JSON.stringify(c.data.selectedCountry) or JSON.stringify(input.selectedCountry)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 10:27 PM
if i use this it gives me output: {"$$hashKey":"object:77"}
no country name, instead getting object:77
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 11:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 11:17 PM
I am actually fetching the country values from server side like this:
(using custom table as per client requirement)
data.cnt = [];
var cnt = new GlideRecord('x_vrm_lite_vrm_core_country');
cnt.addEncodedQuery('active=true');
cnt.orderBy('name');
cnt.query();
while (cnt.next()) {
var cntObj = {};
cntObj.label = cnt.name.toString();
cntObj.value = cnt.sys_id;
data.cnt.push(cntObj);
}
now how to I use this data.cnt in client script to populate the values.
Setting static values in client script are working fine for me as well.
If I am able pass data.cnt in client script then I thing it will work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 11:32 PM