Mandatory variables on Service Catalog RITM records are intermittently created with empty values
Mandatory variables on Service Catalog requested item records are intermittently created with empty values.
This article applies when the following symptoms and conditions are present:
- Requested items are intermittently created with missing values for all/some mandatory variables.
- Other variables on the requested item have values.
- Catalog client scripts are used on the catalog item or variable sets.
- Asynchronous GlideAjax was used in the catalog client scripts to auto-populate fields that are mandatory; or asynchronous GlideAjax are used in the catalog client scripts and response determines if mandatory flag is set for another variable; or asynchronous GlideAjax are used in the catalog client scripts of the catalog item or variable set.
An asynchronous GlideAjax, "getXLM(<callback function>)" allows the client side to continue to load without waiting for a response from the server; it includes a callback function that processes the GlideAjax response once received. When catalog client scripts on a catalog item or variable set contains asynchronous GlideAjax, users are able to checkout before the response is received, before the mandatory variables are populated, or before the mandatory flag is evaluated based on the result of the response. These scenarios will result in the mandatory variable not containing a value.Resolution
Because of the nature of asynchronous GlideAjax, add an onSubmit catalog client script to re-evaluate/re-affirm that mandatory variables are not empty during the checkout process. This process also allows extra time for the response from the server to come back. For more information about creating the onSubmit catalog client script to verify that a mandatory variable is not empty, see KB0622896.