Force the Updated Script to Execute
- Create a new Incident
- Select the Clear log icon to remove any existing log messages
- Select your preferred view (Small, Medium or Large) so the log messages are visible at the bottom of your screen
- Update the value of Impact to 1-High
- Review the log messages in the JavaScript Log: What is the value currently in the incState variable? What should it be? Does the string "LINE 11 EXECUTED!" appear as a logged message?
- At this point, you know something is wrong with the value in incState variable. Before leaving the Incident form, double-check the State field's name by right-clicking the field's label
- Open the Lab 2.3 Client Script Debugging Client Script
- Locate the statement at the beginning of your script that reads:
var incState = g_form.getValue('incident');
- Review the State field's name in this statement, does it match the field name you documented in step-6?
- Update the statement to:
var incState = g_form.getValue('state');
- Select Update
- Force your updated script to execute by creating a new Incident. If you closed JavaScript Log, re-open it
- Clear the JavaScript log
- Update the value of Impact to 1-High
- Confirm the Lab 2.3 Client Script Debugging Client Script executed as expected
A decoration appeared to the left of the State field ( ? ) The State's label flashed teal for four seconds ( ? ) The State choice list options now only include 'New' and 'In Progress' ( ? ) An Information Message appears at the top of the form confirming the State options removal ( ? )
- Review the messages in the JavaScript Log: Is the value of incState 1? Does the string "LINE 11 EXECUTED!" appears as logged message?
- If you answered No to any of these questions in two previous steps, debug and re-test
- Close the JavaScript Log and Field Watcher by select the Close icon
- Review the InfoMessage at the top of the form. Are you the only person who can see this script output?
- Form messages are a good debugging strategy as the results are instantly presented the top of the form you are testing on. Would this type debugging strategy be best in a development or production instance?