Service Catalog Client Script Glide Record

Steve A
Kilo Expert

I am building a quick form for itil use until we build out the full procurement application. There are 5 variables: requested_by (reference to sys_user), location (reference to location), vendor (lookup select box to core_companies with filter vendor = true&&state=active), description (single line text), purpose(multi line text).

I am working on a onChange client script but getting lost as I try to clarify what is server-side vs what is client-side. The script should run everytime the vendor field changes and needs to GlideRecord the core_companies table to confirm that the u_primary_contact field is not null. if it is null then notify the user. The simple workflow will send an email to the primary contact of the vendor with the form variables thus notifying them of an order. and then the workflow closes the request as it is only record keeping and not the full procurement system. Below is what I have done and i don't believe it has a chance. Any help is appreciated.

find_real_file.png

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

You might also consider modifying the filter on the vendor variable to only show companies where the u_primary_contact field is not null.

View solution in original post

6 REPLIES 6

amaury
Tera Guru

Hi there,

One code issue I see mainly is :

==> The field vendor is a lookup select box to core_companies with filter vendor = true&&state=active.
That said, its value can be null, 1 sysId or even a list of sysIds. 

the line 8 is wrong because ven.addQuery('sys_id', g_form.getValue('vendor')); translate tot sys_id IS g_form.getValue('vendor'). 

You can't compare sys_id with a potential multi sys_id. 

You should use ven.addQuery('sys_id', 'CONTAINS' ,g_form.getValue('vendor')); //CONTAINS or IN should do it 

Jim Coyne
Kilo Patron

You might also consider modifying the filter on the vendor variable to only show companies where the u_primary_contact field is not null.