how to abort action in client UI Action?

qwertyflop
Giga Guru

I need to modify the "Request Approval" UI Action to abort if a field is empty when it is clicked. How can I accomplish that? Can't use current.setAbortAction(true) because client side, and returning false does not seem to work either.

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

You would add code to not have it execute that actual action, save or submit or whatever you're doing.

Ideally, you'd instead use an if else type solution to branch and let the user know to populate 'x' field.

g_form.addErrorMessage("Message");

This validation could be done at the very top of the code and then the else goes into the actual script if the field is not empty:

if (g_form.getValue('field_name' == '') {
g_form.addErrorMessage("Please fill in a value for x field");
} else {
//do the other code
}

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

1 REPLY 1

Allen Andreas
Administrator
Administrator

Hello,

You would add code to not have it execute that actual action, save or submit or whatever you're doing.

Ideally, you'd instead use an if else type solution to branch and let the user know to populate 'x' field.

g_form.addErrorMessage("Message");

This validation could be done at the very top of the code and then the else goes into the actual script if the field is not empty:

if (g_form.getValue('field_name' == '') {
g_form.addErrorMessage("Please fill in a value for x field");
} else {
//do the other code
}

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!