Notifications

358 views

Description

Date validation in Service Portal does not work when the variable is made mandatory in the variable record or using a script. Manually typed invalid dates can be saved incorrectly, such as '02-09-0017', when the variable is set to Mandatory.

When using the Service Portal and interacting with service catalog Date variables, there is no check on the date format when the date field is set to Mandatory. When dates are manually typed using a two-digit format for the year (i.e. dd-MM-yy), the dates are saved in an incorrect format (i.e. 02-09-0017). The system is setting the date as dd-MM-yyyy, but the leading zeros come from the year value are being entered as 2-digits instead of four.

Steps to Reproduce

 

  1. Navigate to System Properties > System and confirm that the 'glide.sys.date_format' property is set to 'yyyy-MM-dd'.
  2. Edit the 'Create incident' Record Producer and add a Date variable 
    https://<instance-name>.service-now.com/sc_cat_item_producer.do?sys_id=3f1dd0320a0a0b99000a53f7604a2ef9
  3. Navigate to Service Portal > Open the catalog item 'Create incident'
    https://<instance-name>.service-now.com/sp?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9
  4. Manually type the value of the Date field as '17-09-02' and click away from the date field:
    Note the message saying you used the wrong format - you aren't allowed to save the form, which is expected.
  5. Set the variable to Mandatory
  6. Open the Catalog Item again https://<instance-name>.service-now.com/sp?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9
  7. Manually type the value of the Date field as '17-09-02' and click away from the date field:
  8. Submit the form and look at the saved incident. You do not see the bad-formatting message, and you are allowed to save the bad value, which saves as 0017-09-02.


1. Go to the catalog item named 'Sample Item' and set it to active.
2. Open the catalog item in service portal and enter a value manually in date field.
3. When we remove the focus from that field, we notice that there is an error message that says 'Enter date in format YYYY-MM-DD'.
4. Go to the variable record for 'Date' and set Mandatory to true.
5. Open the catalog item in service portal and notice that when we enter a value manually, and remove the focus, it greys out the asterisk symbol but does not give the message regarding invalid format.
6. If we now clear out the value, it gives the error message.

Workaround

This problem is fixed in Madrid. There is no workaround for earlier versions. If you are able to upgrade, review the Fixed In field to determine whether any versions have a permanent fix.


Related Problem: PRB1300937

Seen In

London
London Patch 1 Hot Fix 2

Fixed In

Madrid

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-30 11:33:14
Published:2019-05-30