31 views

Description

onChange client Scripts are executing twice on Date Variables when their value is cleared or changed as part of the script in Service Portal

Steps to Reproduce

  1. Log in to an OOTB London instance (verified in demonightlylondon)
  2. Open the record producer 'Create incident'
    • https://<instance-name>.service-now.com/nav_to.do?uri=sc_cat_item_producer.do?sys_id=3f1dd0320a0a0b99000a53f7604a2ef9
  3. Create a Date variable, say 'start_date'
  4. Create an onChange catalog client script on the above Date variable as follows:
    • Name: test alert
    • UI type: all
    • Type: onChange
    • Variable name: start_date
    • Script:
      function onChange(control, oldValue, newValue, isLoading) {
      if (isLoading || newValue == '') {
      return;
      }
      //Type appropriate comment here, and begin script below
      if(newValue) {
      alert("Called-oldvalue:"+oldValue+";newvalue="+newValue);
      g_form.clearValue('start_date');
      }
      }
  5. Open the Record Producer from the Service Portal
    https://<instance-name>.service-now.com/sp?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9
  6. Select a date for the above Date variable

Expected behavior:
When you change the value of Date Variable 'start_date', the alert should show once.

Actual behavior:
When you change the value of Date Variable 'start_date', the alert shows twice.

Note: The issue is seen only on Date variables. If we repeat the same steps for a Single Line Text variable, the alert is shown only once.

Workaround

This issue is under review. To receive notifications when more information is available, subscribe to this Known Error article by clicking the Subscribe button at the top right of the article. If you are able to upgrade, review the Fixed In field to determine whether any versions have a permanent fix.


Related Problem: PRB1301582

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-09-18 15:54:33
Published:2018-09-14