Get value of list type (glide_list) within a UI Action client script

SG17
Tera Expert

I’m able to get the value of a reference field (g_form. getDisplayBox(‘fieldname’)) and String (g_form.getValue(‘fieldname’)) within my UI Action client script but how can I get the display value of a glide_list type field? It's the type that has the lock icon next to it and allows multiple selections. The closest I have got was using getValue() but it only returns the sys_ids unlike the reference type which returns the display value.

Thanks for any help!

2 REPLIES 2

Michael Jones -
Giga Sage

This example works on the Incident form and will alert the display values of the names added to the Additional Assignee field.

You would need to add the Isolate Script field to the form and set it to false (unchecked) or do the same via the list view for this to work (as it uses DOM). This would only work in the UI (not the Service Portal). 

//update field to be the name of your field
var field = 'additional_assignee_list';
var displayVals = $(g_form.getTableName() + '.' + field + '_nonedit').innerHTML;
alert(displayVals);

If this was helpful or correct, please be kind and remember to click appropriately! Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Thanks but JQuery ($) is not available on a UI Action. I ended up putting server side code outside of my Onclick function which is executed when the page loads and sets a global variable that can then be used in the Onclick method. I also tried to use GlideAjax to get the value but since it's only asynchronous on the client and I needed values in order I had to abandon that method.