Help with g_navigation.openPopup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 03:13 AM
Hi All,
I have created a UI Action that is designed to allow a Change requester to click a button and see a list of other changes with a specific set of conditions already built in and have it open in a new tab/window.
When i had this as a server side UI Action using action.setRedirect the resultant list showed perfectly as the list of changes with conditions built in, however, our Change function wanted this to open in a new tab/window.
I reworked the UI Action to be 'Client' and swapped the action.setRedirect for g_navigation.openPopup(url) - url added as a var.
Again this was not quite perfect as the new window opened as wanted and a list appeared, however, the conditions were present but needed to be manually run.
My question is, how can i get the conditions to run automatically using the g_navigation approach??
Please see script below and any assistance greatly appreciated;
function scheduleAssist() {
//gs.log("VRS: StartDate == " + g_form.getValue("start_date")+ " EndDate == "+ g_form.getValue("end_date"));
var unparsedValueStart = g_form.getValue("start_date");
var unparsedValueEnd = g_form.getValue("end_date");
var parseStartDate = unparsedValueStart.split(" ");
var parseEndDate = unparsedValueEnd.split(" ");
var parseStartTime = parseStartDate[1].split(":");
var parseEndTime = parseEndDate[1].split(":");
var url = "/change_request_list.do?sysparm_query=start_date%3C%3Djavascript%3Ags.dateGenerate('"+parseEndDate[0]+"'%2C'"+parseEndTime[0]+"%3A"+parseEndTime[1]+"%3A"+parseEndTime[2]+"')%5Eend_date%3E%3Djavascript%3Ags.dateGenerate('"+parseStartDate[0]+"'%2C'"+parseStartTime[0]+"%3A"+parseStartTime[1]+"%3A"+parseStartTime[2]+"')%5Eactive%3Dtrue";
g_navigation.openPopup(url);
}
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 04:54 AM
If you are referring to hard coding the dates i am using as part of the conditions, unfortunately i can't do that as they are going to be different on every change?!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 05:09 AM
Hi Steve,
That should be fine; just check whether the url is formed correctly before it redirects
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 05:22 AM
Apologies Ankur,
Not sure i am understanding what you mean by "check whether the url is formed correctly before it redirects"
It works perfectly via setRedirect, what would i need to check??
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 05:25 AM
Hi Steve,
try to add alert for the url
var url = "/change_request_list.do?sysparm_query=start_date%3C%3Djavascript%3Ags.dateGenerate('"+parseEndDate[0]+"'%2C'"+parseEndTime[0]+"%3A"+parseEndTime[1]+"%3A"+parseEndTime[2]+"')%5Eend_date%3E%3Djavascript%3Ags.dateGenerate('"+parseStartDate[0]+"'%2C'"+parseStartTime[0]+"%3A"+parseStartTime[1]+"%3A"+parseStartTime[2]+"')%5Eactive%3Dtrue";
alert(url);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 06:56 AM