In ServiceNow, Open catalog client Scripts [catalog_script_client] and paste the code snippet of [spModalSweetAlerts.js] file.
Setup:
- A catalog item having variable name Rewards[rewards] of type 'Select Box'(include none as true) and 2 choices(Yes and No)
- A Single line type field named 'Reward Selected' [reward_selected] which will hold the value selected by user from the spModal popup.
- The onLoad catalog client script setup as below:
- Type: onChange
- Variable: rewards (as per step 1)
- Script: [[spModalSweetAlerts.js]]
Screenshots:
Rewards selected as 'Yes'
From the spModal popup select anyone of the reward, it should be populated in the Reward Selected field. Along with that a message shows the same of the selection.