Trying to use ref_ac_columns=user_name;email,ref_ac_columns_search=true,ref_auto_completer=AJAXTableCompleter attributes on a glide_list variable. but it is not working

Prateek Gupta3
Mega Guru

Hi Community,

I am using list collector variable. This field is referring to sys_user table. Then ,I used glide_list attribute on this list collector.   Name field on the sys_user table is display true. But I have requirement to search using email_id, name as well. I am using the attributes as given below.This field is referring to sys_user table.

find_real_file.png

Please help on this.

Thanks
Prateek Gupta

3 REPLIES 3

Hadyn
Tera Expert

I have the same issue. I use glide_list attribute also. I am on Jakarta version. The above works fine in service portal. But doesn't work in the CMS.



It looks like the UI Macros/Jelly used to render the catalog item in the CMS just ignore those variable attributes and always render the glide list reference lookup as a AJAXReferenceCompleter which by default only shows the display value of the record.



I did find a really hacky way to get around it though.



I created a catalog client script that applies to my variable and overrides it to an AJAXTableCompleter instead.



Table: Catalog Client Script


Type: onChange


Variable Name: the name of your list collector type variable


UI Type: Desktop //this way it wont effect service portal


Script:


function onChange(control, oldValue, newValue, isLoading) {


  if (!isLoading) { //we dont really want it to run onchange just onload, but its nice to be able to reference "control"


      return;


  }


  var el = gel("sys_display."+control.id); //go get the input DOM element that the reference completer is set on


  el.ac = new AJAXTableCompleter(el,control.id); /*There is an onfocus event that is bound to this element by default which sets the ac (auto completer) if its


not already set, so before that happens lets set it manually*/


  el.ac.setAdditionalValue("ac_columns", "email"); //sorry but have to manually pass the fields you want displayed, the ones you normally put in ref_ac_columns


//Doesnt look like "ref_ac_columns_search=true" is honored but for my use case I just needed to at least display the email field


}


Hi Hadyn,

Thanks for code here, I tried its working on ITIL view but throwing JavaScript error on portal.

Getting following error in browser

(g_env) [SCRIPT:EXEC] Error while running Client Script "Add More User ": ReferenceError: 'gel' is undefined

 

Thanks in advance.

Ashish

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Thanks Haydn, this worked fine for me in the old CMS portal.

 

//Per