- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 01:59 PM
Our Incident Tasks have two button (UI Actions) that are designed to change the state to Closed Complete or Closed Skipped. When one of these buttons is clicked, we are looking to set the close_notes field on The Incident Task as Mandatory to ensure something is entered in the field.
I have created a UI Policy that sets the field as mandatory when the State is Closed Complete or Closed Skipped. With this UI policy active, the Close button changes the state to Closed Complete and sets the field to mandatory. What need to happen is the the field is to become mandatory without changing the State. In addition, if I select the Closed Complete option from the field drop-down, the field becomes mandatory (as I would expect).
In short, the UI Action is not enforcing the mandatory field to be populate prior to changing the state. Below is a copy of that UI Action followed by the UI Policy.
I'm not sure what I am missing. Ideas/Suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 02:36 PM
Hello Kevin
Can we try something like this
Script:
function runClientCode(){
if(g_form.getValue('work_notes') == ''){
g_form.addErrorMessage("This state cannont be changed with empty worknotes");
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'closed_complete'); //MUST call the 'Action name' set in this UI Action
}
if(typeof window == 'undefined'){
serverQualify();
}
function serverQualify(){
current.state = 3;
//Create the html contents of the information message
current.update();
action.setRedirectURL(current);
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 02:10 PM
You can try writing the script inside a if-loop in the following manner,
if(current.close_notes != null){
current.state = '3';
action.setRedirectURL(current);
current.update();
}
else{
alert("Close Notes are Empty");
}
I hope it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 02:36 PM
Hello Kevin
Can we try something like this
Script:
function runClientCode(){
if(g_form.getValue('work_notes') == ''){
g_form.addErrorMessage("This state cannont be changed with empty worknotes");
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'closed_complete'); //MUST call the 'Action name' set in this UI Action
}
if(typeof window == 'undefined'){
serverQualify();
}
function serverQualify(){
current.state = 3;
//Create the html contents of the information message
current.update();
action.setRedirectURL(current);
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2018 08:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2018 08:29 AM
Hello Kevin
Glad that it worked for you. Cheers
Please mark my response as correct and helpful if it helped solved your question.
-Thanks