- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 12:42 PM
Hi guys,
I couldn't make the this code work. For some reason it's stopping at this line: gr.addQuery('u_parent', current.sys_id);
When I debugged, current object is null. I'm having a scratching-my-head moment! Any help is greatly appreciated. Thanks
Note:
This is being called in UI Action
'Client' is checked
onClick = myFunction()
function myFunction(){
var hasRecord = false;
var gr = new GlideRecord('u_cost_model');
gr.addQuery('u_parent', current.sys_id);
gr.query();
if(gr.hasNext()){
hasRecord = true;
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 12:43 PM
Hi Regina,
You don't want this to be a client script... There is nothing client side about it.
Uncheck Client.
Remove the function call.
Script:
var hasRecord = false;
var gr = new GlideRecord('u_cost_model');
gr.addQuery('u_parent', current.sys_id);
gr.query();
if(gr.hasNext()){
hasRecord = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 12:43 PM
Hi Regina,
You don't want this to be a client script... There is nothing client side about it.
Uncheck Client.
Remove the function call.
Script:
var hasRecord = false;
var gr = new GlideRecord('u_cost_model');
gr.addQuery('u_parent', current.sys_id);
gr.query();
if(gr.hasNext()){
hasRecord = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 01:11 PM
Working now, thanks Chuck!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2016 01:11 PM
I'm glad you got your question answered. Thank you for participating in the community.