Time Zone in ServiceNow API Request


I found out that the time zone settings (e.g for due date) in ServiceNow API call is a bit tricky when trying to automate the change request creation in ServicerNow. Here is the rule that I figured out:

If the account that is used for making the API request has time zone settings, then the datetime related input will use the same timezone. Otherwise, it will use the ServiceNow instance default timezone settings.

How to check the time zone settings of an account? Look for time_zone in the http get request of the following endpoint.

https://<your_instance>.service-now.com/api/now/table/sys_user?sysparm_query=user_name=<your_account>

The datetime value is stored as UTC time in the ServiceNow table. If you set sysparm_input_display_value differently, then datetime value will be different too.
true: returns the display values for all fields.
false: returns the actual values from the database.
all: returns both actual and display values.

The display value varies based on the account settings, e.g timezone.

Reference:
https://developer.servicenow.com/app.do#!/rest_api_doc?v=london&id=r_TableAPI-PUT

Advertisement

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