Fetch Incident Data for UTC timezone irrespective of User account's timezone

Keerthigasri R
Kilo Contributor

Hi, 

I'm using RestAPI to get the incidents from Servicenow which are updated between particular intervals of time (eg: 18-01-2022 10:00 AM  to 18-01-2022 10:30 AM). I'm facing timezone related issue while getting the payload from Servicenow. 

The issue is as follows:
My Account's TimeZone = America / LosAngels
TimeZone used in API call = UTC

So whenever I fetch the data, I get incidents which are updated between the intervals of American timezone and not UTC timezone. Is there any way that I can fetch data between UTC time intervals irrespective of Account's timezone ?

I have gonethrough timezone related questions in community forum. Unfortunately I haven't found what I'm looking for. Any suggestions or ideas to solve this issue will be highly helpful.

 

Thanks,
Keerthi

1 ACCEPTED SOLUTION

Hi,

for that I believe you need to use scripted REST API and manipulate and then query and return the results

Regards
Ankur

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

try to send sysparm_display_value = false in your REST API call, & check if it returns UTC/GMT time

find_real_file.png

Regards
Ankur

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

Hi Ankur,

My issue is not about getting display values as UTC. I need to fetch the incidents that are updated in American Timezone intervals using its equivalent UTC timezone. 

For Example:

If an incident (INC0010012) is updated on = (2022-01-13 03:30:32 / American Timezone)

I should be able to get the above data (INC0010012) as result by using this query `sysparm_query=inc_sys_created_on(2022-01-13 11:30:32 / Equivalent UTC Timezone)`.

But in my case, it is giving me an empty array as an object. Kindly do let me know any ideas on this or elaborate a little bit if I'm missing anything.


Note: I tried your answer, it is still throwing me an empty array. I use postman for API calls

Thanks,
Keerthi

Hi,

for that I believe you need to use scripted REST API and manipulate and then query and return the results

Regards
Ankur

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

@Keerthigasri R 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

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