Bite #15: Using SAMEAS in GlideRecord Queries

A few versions ago, ServiceNow added the ability in filters to query for records where one field was “the same as” another field…

Same As Filter

ServiceNow allows you to query for records where one field is the same as another

I’ve occasionally wondered if I could accomplish the same thing in a GlideRecord Query. A few weeks ago, a coworker had a dire need for this functionality, so we experimented and figured it out:

gr.addQuery(‘sys_updated_on’, “SAMEAS”, “sys_created_on”);



Categories: Developers

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: