How to populate list with script include and client script

Steve42
Tera Expert

I have a script that populates a listbox with the displayValue.  That is not going to work because I have comma's in the names of the companies that are in the listbox.  This is not a list collector it's a list find_real_file.png

I can get the display value in there but it's not linking to the company when I click the preview it show nothing but if I add it with the lookup field it works as far as giving me the company in preview.

What am I doing wrong?  I have the script include/client script (that populates based on a T/F field). These work but can't put the sys_id in the field and have it work (return the company name with the sys_id showing.

 

1 ACCEPTED SOLUTION

Steve42
Tera Expert

I found the problem, I was referencing the incorrect table.  I was looking at Contracts instead of pulling from Company records.

View solution in original post

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

Share your scripts and we'll get it sorted out.

Brad Bowman
Kilo Patron
Kilo Patron

I don't think I'm following.  The Display Value of your Companies list should be Name, but it shouldn't matter if Name contains a comma.  If you have a script that is populating the List field, it should be doing so with sys_ids, but it will display Name - with or without commas.  You can also use the search box to lookup a company by name, or select the search icon to select a company from the pop-up window, so which part isn't working for you? 

I have populated the List Ref field via an onChange client script and script include.  All of the records returned by my SI are included.  I can also search for additional companies to populate

find_real_file.png

Would love to see the script you used - I bashed my head against a brick wall for hours and got nowhere. I raised a HI ticket and they couldn't solve my problem either!

Sounds like a challenge.  I don't know if I still have this example, but at the basic level you could hard-code a list of sys_ids for records on the list table, then in a client script g_form.setValue of that field to that list.  It seems like in this post I was calling a Script Include to get the correct list of values.  What is it you are trying to do?