
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-29-2018 03:12 AM
Hi all,
At least for Jakarta action.setRedirectURL(url) doesn't work in the Portal .
Here is my workaround.
It adds extra function call before action.setRedirectURL(url) + a code to get data in portal form.
new UserPreferences().setUrlToOpen(url);
action.setRedirectURL(url);
Line 90 of Form widget - add additional function call after last then to get
loadForm($scope.data.table, sysID).then(constructResponseHandler(response)) .then(redirectFix);
function redirectFix(){
ctrl.data.action = "checkRedirect"
ctrl.server.update().then(function(response){
if(response.forceRedirectTo){
$window.location = (response.forceRedirectTo);
} else {
ctrl.data.action = ""
}
})
}
Server side action is:
if(input.action === "checkRedirect"){
var urlToOpen = new UserPreferences().getUrlToOpen();
if(urlToOpen){
data.forceRedirectTo = urlToOpen;
}
return;
}
I save temp values to user preferences, but in your case in could be better to place temp data to user session.
var UserPreferences = Class.create();
UserPreferences.prototype = {
initialize: function() {
this.urlPref = "fix.redirectAction.url";
this.urlPrefTimer = "fix.redirectAction.url.timer";
},
/*
save url. use to fix action.setRedirect for the Portal
*/
setUrlToOpen:function(url){
gs.getUser().savePreference(this.urlPref, url);
gs.getUser().savePreference(this.urlPrefTimer, new Date().getTime());
},
/*
When to url or it is older then 1 minute - returns empty string
*/
getUrlToOpen: function(){
var url = "";
var old = gs.getUser().getPreference(this.urlPrefTimer);
var outDated = (new Date().getTime() - old ) /1000 > 60;
if(!outDated) {
url = gs.getUser().getPreference(this.urlPref);
}
return url;
},
type: 'UserPreferences'
};
- 4,655 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Because I don't know what I'm doing I couldn't figure out all of what was going on above.
That said I hacked something that appears to be working for me - probably missing some essentials but I did:
//CLIENT CONTROLLER
// appended to extant line '.then(redirectFix);'
loadForm($scope.data.table, sysID).then(constructResponseHandler(response)).then(redirectFix);
// added this at the end
function redirectFix(){
ctrl.data.action = "checkRedirect"
ctrl.server.update().then(function(response){
if(response.forceRedirectTo){
$window.location = (response.forceRedirectTo);
} else {
ctrl.data.action = ""
}
})
}
// SERVER SIDE SCRIPT
// added this at the end
if(input.action === "checkRedirect"){
data.forceRedirectTo = 'https://<MY WANTED REDIRECT URL>';
return;
}
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
what is : this.urlPref = "fix.redirectAction.url";
this.urlPrefTimer = "fix.redirectAction.url.timer"; in script include ?
in ROME : OOB widget after which line of code i have to add your client code / server code

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
this.urlPref and this.urlPrefTimer are
Just names of the user preference to store/restore data. You can use any text here
>in ROME : OOB widget after which line of code i have to add your client code / server code
In the client it would be line 135.
Please refer to original message:
loadForm($scope.data.table, sysID).then(constructResponseHandler(response))
-> place .then(redirectFix); after .then(constructResponseHandler(response))
For server-side it would be any place before following code
if (input) {
so i would use line 20 for Rome