setRedirectURL(current) does not working when using with setAbortAction
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 01:15 AM
I am modifying the Save button with the following logic:
- If the Number field has a value greater than 100, update the record.
- If the value is 100 or less, abort the action.
Here is the code:
action.setRedirectURL(current);
if (current.u_number > 100){
current.update()
} else {
current.setAbortAction(true);
}
The issue I'm encountering is that when setAbortAction is triggered, the setRedirectURL does not work as intended. Specifically, I am always redirected to the previous screen.
I have tried placing setRedirectURL(current) in various positions within the code (for example, between different lines), but nothing seems to resolve the issue.
How can I ensure that I stay on the current screen when the abort action is triggered?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 04:18 AM
It should work like this:
if (current.u_number > 100) {
current.update()
} else {
current.setAbortAction(true);
}
action.setRedirectURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 05:16 AM
Hi @Anh
You can try something like below:
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."
Thanks!