Need help modifying UI action to check if field is empty and show error message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:14 AM
Using this UI action that is calling a script include, I am trying to check if a variable on the RITM is populated. If it's empty I want to show an error message. Unfortunately I am having trouble preventing the submission if the conditions are not met
if (current.variables.request_type != ''){
var apiUtils = new ServiceRequestAPI(); //POST service request information
var workOrder = apiUtils.generateWorkOrder(); //Call script include that contains POST message
var request_type = current.variables.request_type;
current.state = 2; //set the state to in progress
current.watch_list = current.variables.trimark_csr; //add the user selected to the watchlist
current.comments = ' WO Requested';
gs.addInfoMessage(' WO Requested');
current.update();
action.setRedirectURL(current);
} else {
gs.addErrorMessage('The following mandatory fields are not filled in: Resolution);
return false;
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:32 AM
Do you have client unchecked?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:36 AM
Try unchecking "client".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:41 AM
No errors but when i click the button for either condition, it redirects me to the previous screen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 07:43 AM
is --None-- a value from that variable?