Client script : get the value of List Type field value

Gurushant2
Mega Contributor

I am seeking for any direct method to get the Display Value of Glide List type of field on client script.

I tried using g_form.getValue('Skills'), but it gave me Sys ids list seperated by commas(',').. I don't want to call GlideAjax to get the value from Data base script as it takes little more time to process.

See image below

find_real_file.png

Wondering if we have any direct method to get on g_form object. 

 

Thanks,

 

5 REPLIES 5

Anil Lande
Kilo Patron

Hi,

Please find the below link:

https://community.servicenow.com/community?id=community_question&sys_id=9ee303e5dbd8dbc01dcaf3231f96...

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi Anil,

 

Unfortunately, It couldn't help as I am working in scoped application. $ is not allowed in scoped app.

Any other ways I can try out ??

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Gurushant 

just use this link for the solution; it uses DOM manipulation which is not recommended

can we display list field values in the alert message

Sharing the script here

1) Ensure Isolate Script Field is set to false for your client script to allow DOM

2) This field if not on form then from the list you can make it false

var field = 'work_notes_list';
var values = $(g_form.getTableName() + '.' + field + '_nonedit').innerHTML;
alert(values);

Output: It gave me 2 user's display value

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

Unfortunately, It couldn't help as I am working in scoped application. $ is not allowed in scoped app.

Any other ways I can try out ??