Determining if client script settings are incorrectly configured
- No variables on form
- Variables values wiped out
- Mandatory value not mandatory
- Not mandatory is actually mandatory
- Variable not visible
- Variable is read-only
- Variable is not read-only
Client scripts run after the original variable configurations are rendered, so it is possible that the client scripts override the behaviors with which the variables are configured.
To determine if client script settings are incorrectly configured:
- Navigate to Self-Service > Service Catalog.
- Open the item that is behaving incorrectly.
- On the item page, right-click the header bar and open a client script.
- Try the following troubleshooting steps:
- If a sub-production environment is available for testing, a simple way to test if the client script could be causing issues is to turn them off (active=false) in the sub-production environment and check if the issue still occurs.
- Check lines in scripts such as ...setReadOnly(..) or ...setMandatory(...).
- Client scripts can also be used to set Values in variables or remove invalid values. If these are used, it is possible that the created records have unexpected values.
- Client scripts can be defined on the catalog item and also on the target record. For example, the requested item record where the variables are placed. The two client scripts may be clashing.
- If there is a same named field on requested item and variable on the catalog item, a client script that does something like:
- g_form.setMandatory('same_name_field',true) may have unexpected response
- It is recomended you explicitly call out variable names by using the variables. prefix. For example, the above script, if it was for the variable, should be:
- This would remove any confusion about which element you wish to target
- The example above shows one example of conflicts that client scripts may create. Other conflicts may occur:
- between multiple client scripts on a catalog item
- between client script on a catalog item and client script on the target record
- between client scripts and UI policies
- In most of these cases, a good experiment is to use a sub-production instance, turn off potentially problematic client scripts, and try to narrow down the conflicting scripts.