Client Script: Get value from another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 01:52 AM
Hello!
I have a custom table containing 3 text fields: field_a, field_b, field_c.
In the incident form, I have a reference field called "field_aa" which pulls the data from the custom table.
I have 2 other custom reference fields in the incident form called 'field_bb' and 'field_cc'. I would want these fields to populate when field_aa changes.
ServiceNow version is Kingston.
Please help!
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 02:03 AM
you can use call back function on your onChange() client script.
eg:
var fielda= g_form.getReference('field_aa', doAlert); // doAlert is our callback function
function doAlert(fielda)
{
//reference is passed into callback as first arguments
alert(fielda.field_bb +fielda.field_bb);
}
change the field according to the exact field name that you have.
just give a try
if it will not work then i would suggest to write glideajax to retrive the other columns value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 02:08 AM
Hi there. I've tried that and it did not work. 😞
How do I use glideajax to retrieve the column value?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 02:13 AM
kindly refer the doc link below.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side
just give a try with basic if you are new in glide ajax.
go with doc link . build you script if you stuck let us know

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2018 02:07 AM
Hello,
you can use glideajax to retrieve data from service side.
create a script include to query the custom table with parameters sent by client script and return other two field details.
have a onchange client script on field_aa and send the field value as parameter for script include.
Please refer below link for more details on glideajax.
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference/r_ExamplesOfAsynchronousGlideAjax.html
Thanks,
Ali
Thank you,
Ali