If you have already moved or are planning to move your Service Catalog from Instance version to Service Portal version, then the “Date” or “Date/Time” variable on your catalog items may behave differently.
I have spotted a few differences and will talk about the workarounds and fixes. If you encountered other weird behavior, please try applying the fixes mentioned here and, if that still doesn’t help, post it as a comment below.
Known errors with date variables in Service Portal
Date format and system settings
Variables do not take the date format that users have in their system settings. It always shows the date in the yyyy-MM-dd format.
Example: System Properties > Basic Configuration > Date (glide.sys.date_format) is dd-MMM-yy.
If I go to Service Portal > Service Catalog > Create an incident > Enter date, I expect to see the date as 11-Jul-17 (because my system setting is dd-MMM-yy) but it appears as 2017-07-11 (yyyy-MM-dd).
However, on the instance version, it appears in accordance with the system property
Fix: Although there is no known workaround, the good news is that it is fixed in the product. If you are on Helsinki, please upgrade to Helsinki Patch 8 and up. Or upgrade to Istanbul or Jakarta (preferred). For more information, see KB0610289: ServiceNow KB: Date format not honored in Service Catalog area of Service Portal (gs.nowDateTime()
Date variable on order guides
If user’s system setting is NOT “yyyy-MM-dd”, when a user submits an order guide...
... the system ignores the date entered by user in the variable and changes it to the date when the order was submitted.
Fix: There is no known workaround but it can be fixed with an upgrade or patch:
- If you are on Helsinki, apply Patch 12 or later.
- If on Istanbul, apply Patch 9 or later.
- For Jakarta, apply Patch 2,
The date variable on Service Portal DOES perform validation on the client side, but still allows you to submit the order. This means the user can submit an order when entering something other than a date in the date variable. However, the validation works on the instance and it will show an error restricting the user from submitting.
Example: If I write the text "Hello" in date variable, it shows me the error:
However, when I click Submit with “Hello” in the date variable, it go through the submission and creates a request for me:
It submits the order with the date I submitted the order.
Fix: I will confirm on this blog when a fix will be available. In the meanwhile, the easiest workaround is to use the Help Text field. Add a message like “The order won’t be fulfilled if date entered is not in this <the format you want to be used> format.”
For more details on this issue, see KB0622400: In Service Portal, there is no format check for manually typed dates in date fields. You can also subscribe to the article to be notified whenever there is an update, such as an available workaround or patch with a fix.
Just be aware of these issues and fixes if you are planning to move to Service Portal. If you have already moved to portal, hopefully this post will help you mitigate the issue by applying the required patch. If you find other undesired behavior of date/date-time variable on Service Portal, please add a comment below and I will look for a good workaround or fix if possible.