How to exclude the current record in a query?

Mitch Moses
Giga Expert

I am doing a relationship related list and want to exclude the current incident I'm on. How would I go about doing this? 

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Mitch,

 

Plese refer below line of code for referrence

gr.addQuery('sys_id', '!=', parent.sys_id);

 

-Pradeep Sharma

View solution in original post

2 REPLIES 2

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Mitch,

 

Plese refer below line of code for referrence

gr.addQuery('sys_id', '!=', parent.sys_id);

 

-Pradeep Sharma

That didn't seem to work for me.