Issue
This article details the steps to implement checking if a mandatory field is populated before order submission.
This is also the recommended solution for mandatory variables on Service Catalog RITM records intermittently created with empty values.
Release
All releases.
Resolution
- Navigate to Service Catalog > Catalog Policy > Catalog Client Scripts. A list of current custom catalog client scripts appears.
- Click New.
- Fill in the fields:
- Active: Checked
- Applies on a Catalog Item view: Checked
- Type : onSubmit
After selecting onSubmit, the script section will be pre-populated with function, do not delete this. - Script:
function onSubmit(){var mandatoryVar = g_form.getValue('<mandatory variable name>');if (mandatoryVar ==""){alert("<variable name> is mandatory. Please populate the variable and resubmit the request.");return false; }}
- Fill in the remaining fields as needed:
- Name : (any name)
- Applies to : (does the mandatory field belong to a variable set or catalog item?)
- Catalog item or Variable set: (select the catalog item or variable set that owns the mandatory field)
- UI Type : (will this apply to policy apply to Desktop, Mobile or Both?)
- Applies on Requested Items : (check if you want the policy to also apply on requested item view)
- Applies on Catalog Tasks :(check if you want the policy to also apply on catalog task view)
- Click Submit.