The CreatorCon Call for Content is officially open! Get started here.

Need help modifying UI action to check if field is empty and show error message

mdjoseph12
Giga Contributor

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;
13 REPLIES 13

Do you have client unchecked?

find_real_file.png

Try unchecking "client".

No errors but when i click the button for either condition, it redirects me to the previous screen

is --None-- a value from that variable?