Question
Health First
US
Last activity: 17 Sep 2019 6:38 EDT
Reference external URL in Pega portal current window in Pega 7.2.2
Hi All-
I am trying to use 'Open URL In Window' in the section rule to launch the external URL from pega portal. Instead of opening up in a separate window, I wanted to launch the external page in the same window. I tried by passing the parameter window name as "_self", but am getting error.
Can you please suggest how I can achieve this functionality?
Appreciate your responses!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi,
You can use window.location.replace () function in Javascript to open in the same window.
Try calling Run script on the button and give any function name.
In userworkform, define the function.
function testfunc(){
window.location.replace("https://stackoverflow.com/questions/8293983/how-to-use-window-location-replace-javascript");
}
If it doesn't work , try this code:
function testfunc(){
parent.window.location.replace("https://stackoverflow.com/questions/8293983/how-to-use-window-location-replace-javascript");
}
Thanks
Pegasystems Inc.
US
Hi
Can you share your configuration and also the error you are receiving?
Thanks, Elisha
Pegasystems Inc.
US
Hi ,
Could you please try the below configuration .It is working at my end.
1.Place the below code in userWorkForm
<script>
function openUrl(){
var myURL = window.open('https://google.com', '_top');
}
</script>
2.Go to the button action set and for onclick event configure runscript action with openUrl method
-
Dondla Satish
Pegasystems Inc.
US
Thanks, yes it does. I think, only caveat is, you will lose the main window (Pega Application window) with '_top'.
You may want to use '_new' instead of '_top' and the link will be opened in a new tab.
<script>
function openUrl(){
var myURL = window.open('https://google.com', '_new');
}
</script>
Thank you
Health First
US
Thank you for your response. I tried with _new also and it is opening up in new tab instead of opening in my current panel of the harness screen.
Health First
US
Thanks so much for your response. Yes, it worked and replaced my entire window. And I cannot go back if my whole window is replaced. I am having my main harness screen divided into 3 panels: 'Header Panel' and below it 'Left Panel' and 'Right Panel'. I only wanted the new URL to be opened in my right panel, when I click the link from the left panel. Is there a way I can achieve this?
Pegasystems Inc.
US
Hi Prathima,
Have you tried the below script ..
<script>
function openUrl(){
var myURL = window.open('https://google.com', '_self');
//myURL.location;
}
</script>
It should reload in the same frame.
Pegasystems Inc.
US
Hi ,
Just curious why you would want to replace your Pega application with an external page. Do it only if you do not want to return to Pega. In the event you do, there is no guarantee that Pega application will be "preserved" at the same state.