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:10 AM
Hi Steve,
So are you saying when that url is being opened the filter/query is not getting applied correctly
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 04:14 AM
Hi Ankur,
Thanks for the swift response.
Pretty much, it's almost as if the conditions are being passed to the condition builder but not being run.
When the new tab/window opens the query string is there and if you click on the filter button the conditions appear, however, i have to click run for it to take effect.
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 04:37 AM
Hi Steve,
So nothing has changed only the way it was redirected; earlier it was using server side UI action and now it is using client side UI action
In my case I used hardcoded query url in the UI action and when it opened in new tab the conditions were applied correctly. so it works fine for me.
Did you check the url is formed correctly?
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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 04:45 AM
Hi Ankur,
That's good to hear.
Could you possibly paste a copy of what you have sampled that worked and i will look to make the appropriate amendments on mine once compared.
Kind regards