- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 03:12 PM
I have the following code:
var gr = new GlideRecord('new_call');
gr.addQuery('transferred_to',current.request); // we're looking for the original CALL
gr.query(); // perform the query
// If the call that was transferred to this request task was found
if (gr.getRowCount() == 1) {
while (gr.next()){
gs.log('>> RGK <<' + gr.number);
gs.log('>> RGK <<' + gr.sys_id);
current.u_call_number = gr.sys_id;
}
}
Which produces the following output:
Information >> RGK <<CALL0004026
Information >> RGK <<f87c10b4dba083402d4dfb041d9619e4
The field on the current form named u_call_number is a reference to a call (new_call table), but when setting this field to be the sys_id the form does not display anything. The 2nd line in the log output looks to be the sys_id for the CALL so what can be wrong?
Thanks,
Rich.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2017 12:27 AM
Hello Richard,
Please use current.update() function to update the record after setting the value.
like
var gr = new GlideRecord('new_call');
gr.addQuery('transferred_to',current.request); // we're looking for the original CALL
gr.query(); // perform the query
// If the call that was transferred to this request task was found
if (gr.getRowCount() == 1) {
while (gr.next()){
gs.log('>> RGK <<' + gr.number);
gs.log('>> RGK <<' + gr.sys_id);
current.u_call_number = gr.sys_id;
current.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 03:22 PM
Admittedly, I don't completely understand the relationship between your tables. Assuming all that is correct, I'd do something like this ...
var gr = new GlideRecord('new_call');
gr.addQuery('transferred_to',current.request); // we're looking for the original CALL
gr.query(); // perform the query
// If the call that was transferred to this request task was found
if (gr.next()){
gs.log('>> RGK <<' + gr.number);
gs.log('>> RGK <<' + gr.sys_id);
current.u_call_number = gr.getUniqueValue();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 04:04 PM
var gr = new GlideRecord('new_call');
gr.addQuery('transferred_to',current.request); // we're looking for the original CALL
gr.query(); // perform the query
// If the call that was transferred to this request task was found
if (gr.getRowCount() == 1) {
while (gr.next()){
gs.log('>> RGK <<' + gr.number);
gs.log('>> RGK <<' + gr.getDisplayValue());
current.u_call_number = gr.sys_id;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 11:14 PM
I've made that change but the u_call_number field remains blank although the log data shows that it is retrieving the sys_id OK.
The relationship is that I have created a reference field in the sctask table in order to link back to the Call addon application table new_call (this application is not enabled out of the box).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 11:49 PM
current.u_call_number = gr.getDisplayValue();