Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

End task with ui action

jkelvynsant
Tera Contributor

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;
}
}

2 REPLIES 2

surajit3
Tera Expert

Dont use action.setredirecturl it is refreshing the page and allowing the values to be save without the validation being run, 

GeraldKirby
Kilo Sage

@jkelvynsant . 

 

Try to add current.setAbortAction(true); before action.setRedirectUrl.

 

Hope this helps.