ServiceNow WSDL 时区需要更改为用户时区

ServiceNow WSDL Timezone needs to change to Users timezone

我正在从 Servicenow WSDL 获取某种时区格式的数据。 在 Servicenow 中,有一个选项可以更改用户时区并按预期获取数据。但是如果我们在servicenow中更改时区,它不会影响通过servicenow-WSDL传来的数据。

如何为通过WSDL获取的数据转换时区。 servicenow 有什么方法可以自动转换吗?或者有什么想法可以开发我们自己的 script/code 来做同样的事情?

感谢您的宝贵时间。

使用 SN Web 服务时要记住的一点是,默认情况下所有时间值都将返回 UTC 时间。您可以通过将请求参数 "displayValue" 设置为 "true" 以仅返回显示值或 "all" 以返回显示值和直接值来请求 "Display Values"。

时间字段的显示值根据以下条件解析:用户时区首选项,然后是系统时区。

例如,您可以通过以下请求获取 WSDL:

https://<instance>.service-now.com/incident.do?WSDL&displayValue=true

然后还在 SOAP 请求中包含 &displayValue=true:

https://<instance>.service-now.com/incident.do?SOAP&displayValue=true

这是产品文档的 link,其中包含有关通过 SOAP 取回显示值的更多信息:http://wiki.servicenow.com/?title=Direct_Web_Services#Return_Display_Value_for_Reference_Variables

请注意,同样的规则也适用于使用 REST 接口时,但参数是 "sysparm_display_value" (http://wiki.servicenow.com/index.php?title=Table_API)。

希望对您有所帮助。