- 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-22-2017 10:18 AM
it shows the error msg if close notes is empty but it doesn't close the change , it goes to the previous page and if you again click on the record, you don't see any differences.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017 10:32 AM
Check the system logs, as I think you will find an error or warning there that will give you the clue you need
-Jon
Sent from my iPhone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017 12:53 AM
Hi,
Update the state value in Server side in quotes and try your code again:
current.state = '3';
current.update();
Hope this helps. Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke