How to retrieve records based on users timezone in rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 01:26 AM
How to retrieve records based on users timezone in rest api query?..when i am querying I am getting data based on gmt timezone but as per requirement query should work based on users timezone.
How to achieve this..
thanks in advance...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 01:59 AM - edited ‎02-15-2024 07:57 AM
Hi @lucky6,
Working with timezones is always fun, especially via API's.
A few things to consider, dates/times are always stored in UTC. Additionally, an API would typically have an integration account to access the service, so therefore, this too would apply a timezone preference default depending on what the integration account settings are.
Essentially, you would have to make sure the user who is calling on the API is passed as a parameter within the REST call. Within the REST script, you'd then need look up the timezone against the user being passed and then use this timezone to set the timezone required. Thirdly, and importantly, you'd then need to make sure you call on the ".getDisplayValue();" method to pass back the timezone.
I believe I've helped you in a previous post a few weeks ago to which you didn't respond, mark helpful or as a solution.
See here: Did you see the response and did you try the script example?
@lucky6 - To help others (or for me to help you more directly with this post and previous posts), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2024 07:56 AM
Hi @lucky6,
How are you getting on with the timezone API query?
As I mentioned below working with timezones is always fun, especially via API's.
Please take on my considerations - dates/times are always stored in UTC. Additionally, an API would typically have an integration account to access the service, so therefore, this too would apply a timezone preference default depending on what the integration account settings are.
Essentially, you would have to make sure the user who is calling on the API is passed as a parameter within the REST call. Within the REST script, you'd then need look up the timezone against the user being passed and then use this timezone to set the timezone required. Thirdly, and importantly, you'd then need to make sure you call on the ".getDisplayValue();" method to pass back the timezone.
I believe I've helped you in a previous post a few weeks ago to which you didn't respond, mark helpful or as a solution.
See here: Did you see the response and did you try the script example?
@lucky6 - To help others (or for me to help you more directly with this post and previous posts), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2024 01:35 AM
Hi @lucky6 - Did you see my responses below on how to achieve this?
To help others (or for me to help you more directly with this post and previous posts), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie