- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 09:03 AM
Hi,
Actually I can't get the value of a reference field (which refers its table itself )using Glide Record in Script include.
Is it because of same table itself added as reference field?
Ex.
Table1
name parent(reference field ->Table1.name)
John
Sam John
Mike John
So, if I want to know the parent of mike, I suppose to use Table1.parent.name but its not working.
can anyone let me know how we can handle this scenario?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 01:19 AM
@Alextia ,
Filter Navigator -> system logs -> All
Also in my previous reply I have mentioned pls try a small script in background script to get confirmation whether its working or not!
var gr = new GlideRecord("sys_user");
gr,get("SYS_ID_OF_USER");
gs.info(gr.YOUR_FIELD_NAME.name);
Also In your script can you try this : (I am assuming you are implementing reference qualifier on reference field of user table)
var tax_node = new GlideRecord('spm_taxonomy_node');
var tech_srv = tax_node.addJoinQuery('cmdb_ci_service_technical','name','spm_taxonomy_node.name'); tech_srv.addCondition('u_ci_id',current.variables.app_name_with_cmdb.u_ci_id);
tax_node.query();
gs.info("getRowCount() " + tax_node.getRowCount() );// add this for debugging purpose
if (tax_node.next()){
s += tax_node.parent+ ',';
}
return 'sys_idIN' + s;
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 12:46 AM
Query is working fine as retuning the value for tax_node.name instead of tax_node.parent.name.
May I know where I could see the output of gs.info() if I am using the catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 01:19 AM
@Alextia ,
Filter Navigator -> system logs -> All
Also in my previous reply I have mentioned pls try a small script in background script to get confirmation whether its working or not!
var gr = new GlideRecord("sys_user");
gr,get("SYS_ID_OF_USER");
gs.info(gr.YOUR_FIELD_NAME.name);
Also In your script can you try this : (I am assuming you are implementing reference qualifier on reference field of user table)
var tax_node = new GlideRecord('spm_taxonomy_node');
var tech_srv = tax_node.addJoinQuery('cmdb_ci_service_technical','name','spm_taxonomy_node.name'); tech_srv.addCondition('u_ci_id',current.variables.app_name_with_cmdb.u_ci_id);
tax_node.query();
gs.info("getRowCount() " + tax_node.getRowCount() );// add this for debugging purpose
if (tax_node.next()){
s += tax_node.parent+ ',';
}
return 'sys_idIN' + s;
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 02:05 AM