- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 02:36 PM
Actually the close task button on mu change task form , does not close the task ,
the requirement is when the state is closed complete and before closing the task form , the close notes field should be mandatory--> ( which is working) but the part that is not working is ---> it doesn't close the task , when hitting the close task button , the form goes to previous page and the state remain the one which was before. This is my code:
function checkwn(){
if(g_form.getValue('close_notes') == ''){
g_form.setMandatory('close_notes',true);
alert('Please fill in the mandatory fields');
}
else{
gsftSubmit(null, g_form.getFormElement(), 'CheckValue');
}
}
if(typeof window == 'undefined')
saveValue(); // call Server code
function saveValue(){
current.state = 3;
current.update();
action.setRedirectURL(current);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 08:14 PM
Hi Try this,
// Client side onclick function
function closeTask(){
if (g_form.getValue('close_notes') == '') {
try {
g_form.hideFieldMsg('close_notes');
} catch(e) {}
g_form.setMandatory('close_notes', true);
g_form.showFieldMsg('close_notes', getMessage('Please enter supporting close notes when closing the change task'), 'error');
return false; // Abort submission
}
gsftSubmit(null, g_form.getFormElement(), 'closeTaskForm'); //call action name
}
if (typeof window == 'undefined')
closeChange();
function closeChange {
current.state = 3;
current.update();
gs.addInfoMessage(gs.getMessage(current.number + " Change Task was successfully completed"));
action.setRedirectURL(current);
}
Please mark this post Helpful, Like it, or mark as the Correct Answer where applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 03:02 PM
Hi,
Try this code and see if this works , make sure Action name is same
function checkwn(){
if(g_form.getValue('close_notes') == ''){
g_form.setMandatory('close_notes',true);
alert('Please fill in the mandatory fields');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'CheckValue') /Check value must be same as Action Name
}
if(typeof window == 'undefined')
saveValue(); // call Server code
function saveValue(){
current.state = 3;
current.update();
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017 10:01 AM
No change! it goes to previous page without any changes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 07:41 PM
Check the system logs for errors or warnings. I have found that if you have set the UI action to stay on the current form but it still exits, it is hitting an error condition and not completing the ui action code. The logs should give you the clue you need to solve it.
click the close task button and then look for warnings or errors created by your ID in the logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 08:14 PM
Hi Try this,
// Client side onclick function
function closeTask(){
if (g_form.getValue('close_notes') == '') {
try {
g_form.hideFieldMsg('close_notes');
} catch(e) {}
g_form.setMandatory('close_notes', true);
g_form.showFieldMsg('close_notes', getMessage('Please enter supporting close notes when closing the change task'), 'error');
return false; // Abort submission
}
gsftSubmit(null, g_form.getFormElement(), 'closeTaskForm'); //call action name
}
if (typeof window == 'undefined')
closeChange();
function closeChange {
current.state = 3;
current.update();
gs.addInfoMessage(gs.getMessage(current.number + " Change Task was successfully completed"));
action.setRedirectURL(current);
}
Please mark this post Helpful, Like it, or mark as the Correct Answer where applicable. Thanks!