Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Does Not starts with condition in addQuery

Pihu1
Tera Contributor

Hi Community,

I need help in filtering the records , which does not starts with in addQuery() method. How can we achieve this?

Any help would  be greatly appreciated.

Thanks,

Pihu

1 ACCEPTED SOLUTION

Hi,

Sample below

var arr = [];

var rec = new GlideRecord('incident');

rec.query();

while(rec.next()){

var startsWith = rec.caller_id.name.startsWith('AB'); // this will give false when doesn not starts with

if(startsWith.toString() == 'false'){

arr.push(rec.number.toString());

}

}

gs.info('Incidents where caller name does not start with AB'+ arr);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

@Pihu 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

MrMuhammad
Giga Sage

Hi,

Does not starts with is not available in Servicenow but there is a way to achieve this. Please refer @Brad Bowman response on the below thread.

https://community.servicenow.com/community?id=community_question&sys_id=0112d2df1ba5585017d162c4bd4b...

Hope that helps!

Regards,

Muhammad

Regards,
Muhammad