How do I do refresh the portal's homepage from the client side script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 07:24 AM
How do I do refresh the portal's homepagefrom the client side script?
When I use "window.location = home.do';" with the client side script, I get a portal window within the portal window.
This reason for this refresh is that there remains part of form, the form's header, partially overlaid on the portals homepage. This was caused by a user answering "Cancel" on a dialog box when the user declines a form that was just loaded from a request he/she made from the portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2017 04:03 PM
Hi Carew,
What do you mean by refresh? $window.location will not refresh but redirect you to the url passed to location? Can you clarify a bit?
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 10:06 AM
Hi Darshak,
You are correct and I was wrong.
What I would to do on the Portal is to refresh the Portal's webpage when a user click the "Cancel" button in a dialog box.
The reason I would like to do this refresh is remove a partially loaded form which is overlaying on the Portal's web page when the user clicks the "Cancel" button on the dialog box. See below for My Portal's Page partially loaded form, Please not that when the user click's "Okay" on the dialog box the form fully loads.
My Portal's Page
When the user clicks "Cancel" on dialog box, the condition if(con==false) is met (see code below under item JavaScript). The code "window.location='home.do'. is executed. When this statement is executed I get a Portal window within the Portal's web page. This Portal window is the same web page as the Portal's web page. This didn't solve my problem since it not only creates a new tab in the browser, but it did not a refresh of the original Portal web page. See below for My Portal's Page.
My Portal's Page
JavaScript:
function onLoad (control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var con = confirm("You must fill out and attach the Move form to complete your request.\nOnce you download the Move document, you can press Home at the top of the screen to leave this form.");
if(con == false) {
window.location = 'home.do';
}
}
Additional Things Tried
Please note that I considered doing a url redirect with the items (see below for Different Portal's urls for different environments) but this is not easy to do. The problem here is when I deploy to different environments (i.e. dev, test, staging, prod), the application should know which environment it is in. I tried to use g_scrachpad to store a value to retrieved the instance_name (I.e dev, test, staging) from the system properties table I discovered that I didn't have access to the business rules to do this.
Different Portal's urls
https://stateofohio.service-now.com/ess/
https://stateofohiostaging.service-now.com/ess/
https://stateofohiotest.service-now.com/ess/home
https://stateofohiodev.service-now.com/ess/home
Thank You for Reviewing My Post and Any Advice That You Can Give Me.
-Carew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 01:42 PM
Hi Carew,
Can you try this on client side code of widget?
var selection = confirm("Please enter your name", "Harry Potter");
if (selection != true) {
spUtil.addInfoMessage("This is your selection " + selection + "!"); //make sure you add spUtil in the client controller.
$window.location = url here;
// $window.location = c.data.url;
}
Server Script :
data.url = gs.getProperty('glide.servlet.uri')+'sp'; //navigate to index page of your current instance
If selection returns false you can add your redirection code here.
Darshak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2017 09:45 AM
Hi Darshak,
Great! You have something for me!
I'll will try you code at this time.
Thank You,
-Carew