gr.addQuery("incident', Current.sys_id); what is mean of this line?

Shraddha desai
Tera Contributor

Hello,

gr.addQuery("incident', Current.sys_id); what is mean of this line?

addQuery() we used to queried perticuler field or perticuler table also?

 

Thanks & Regards

Shraddha Desai

1 ACCEPTED SOLUTION

Hi

now it makes sense. The variable current holds a GlideRecord reference to a record in the incident table (I suppose that code is from a business rule on the incident table, right?).

The given code queries all records from incident_task table which have a reference specified in the "incident" field and thus pointing to the current incident record.

Add with the help of the additional query conditions the result set is narrowed down to all actice incident_task records which have not a "state" value of "8".

Does this help? 

Kind regards
Maik

View solution in original post

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi

unfortunately you did not provide more context, and so I only can assume that "incident" is really a field name at the table given by the variable "current".

If "incident" is not a field name, then this code line is not correct.

Kind regards
Maik

var gr = new GlideRecord('incident_task'); gr.addQuery('incident', current.sys_id); gr.addQuery('state', '!=', 6); gr.addQuery('state', '!=', 8); // gr.addQuery('active',true); gr.query(); This is a

var gr = new GlideRecord('incident_task'); gr.addQuery('incident', current.sys_id); gr.addQuery('state', '!=', 6); gr.addQuery('state', '!=', 8); // gr.addQuery('active',true); gr.query(); This is a code, can you explain reason of decleration of gr.addQuery('incident', current.sys_id);

Hi

now it makes sense. The variable current holds a GlideRecord reference to a record in the incident table (I suppose that code is from a business rule on the incident table, right?).

The given code queries all records from incident_task table which have a reference specified in the "incident" field and thus pointing to the current incident record.

Add with the help of the additional query conditions the result set is narrowed down to all actice incident_task records which have not a "state" value of "8".

Does this help? 

Kind regards
Maik