Help with g_navigation.openPopup

Steve Chapman
Tera Contributor

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);

}

 

11 REPLIES 11

To add to the previous replies;

As you can see in the above snippet, the dates appear in 19/03/2020 format.

If i condition the list of changes manually and open in a new window the format of the dates shows as 2020-03-19.

Could date format be the reason it is not auto running the conditions and if so, what would be the best way to parse the dates in the correct format??

Kind regards

Hi Steve,

that could possibly be one issue regarding the date format but not sure; will let you know

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader