Query a reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 03:44 AM
I am trying to query a reference field with function, gr.addQuery('name', current.name); Both name and current name are reference field refeering to non display value. But the record is not getting queried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:07 AM
try gr.addQuery('sys_id', current.name); and check the count in the log by giving. gs.log(gr.getRowCount());
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 11:08 PM
I tried with the below code but the record with reference field('assessment_record') is not getting queried.
var gr = new GlideRecord('asmt_m2m_category_assessment');
gr.addQuery('assessment_record', current.vendor);
//gr.addActiveQuery();
gr.query();
while(gr.next())
{
gs.addInfoMessage(gr.assessment_record.getDisplayValue());
gr.deleteRecord();}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 11:43 PM
Hi Charanpreet,
what is the printed value of the assessment_record? is it a sys_id or a value, upon that you can query the records and can delete them.
Regards,
Suresh D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 11:45 PM
It is the name of the company (referring to core_company table).