Redirect to current after submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2015 04:21 PM
I'm currently working on a custom application built from the bottom up and having quite a deal of trouble simply trying to redirect to the record that was just created by the user (on the custom table). Currently there is 1 update business rule and 1 insert business rule (both before) that have the same line of code that works for the user:
action.setRedirectURL(current);
The problem is the records get updated each day by a scheduled job and when the business rule runs when the record is updated action is not defined:
org.mozilla.javascript.EcmaError: "action" is not defined.
Caused by error in Business Rule: 'Foo Foo - Update' at line 4
This "warning" error actually halts my business rule from continuing.
I've tried:
if(action) { action.setRedirectURL(current); }
if(!gs.nil(action)) { action.setRedirectURL(current); }
if(typeof action != 'undefined') { action.setRedirectURL(current); }
if(typeof action != undefined) { action.setRedirectURL(current); }
gs.setRedirect(current.getLink());
gs.setRedirect(current.getLink(true));
gs.setReturn(current.getLink());
gs.setReturn(current.getLink(true));
All I want to do is get the user back to the record they had just created, and have my scheduled job not throw an error every day when it runs.
P.S. Turning business rules or updates off during this transaction is not an option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 11:22 PM
This is a really old post, but please note that if you want to check if action is not undefined you need to do:
if(action !== undefined)
as what you did will check if action has the string value "undefined" and the above will check if the absolute value is undefined. If you want to check if it is undefined, you would do:
if(action === undefined)