End task with ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2025 03:00 PM
Hello, community. I created 3 custom fields in a task table and in it I have the "Close task" UI action. I can only close the task when all three fields are filled in. I can save without all of them being filled in, but I can't close the task. I thought of something like this:
if (current.short_description == 'XXX') {
if (gs.nil(current.u_invoice_id)) {
gs.addErrorMessage('ERROR');
action.setRedirectURL(current);
return false;
}
if (gs.nil(current.u_creation_date)) {
gs.addErrorMessage('ERROR');
action.setRedirectURL(current);
return false;
}
if (gs.nil(current.u_task_status)) {
gs.addErrorMessage('ERROR');
action.setRedirectURL(current);
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2025 03:14 PM
Dont use action.setredirecturl it is refreshing the page and allowing the values to be save without the validation being run,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2025 06:09 PM
Try to add current.setAbortAction(true); before action.setRedirectUrl.
Hope this helps.