- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2015 04:01 PM
I would like to create an Incident from a UI Action and populate two fields on the incident.
I have this code but it doesn't respond. I have also used the GlideDilogWindow and but I can't seem to pass the values to the Incident form
function redirectToIncident()
{
var uniqueid = current.u_caller_unique_id;
var sysId = current.sys_id;
var url = new GlideURL("incident.do");
url.addParam("sysparm_caller_id", sysId);
url.addParam("sysparm_u_caller_unique_id", uniqueid);
var w = getTopWindow();
w.popupOpenFocus(url.getURL(), '_blank', false, false);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2015 04:20 PM
There are several ways to do this, what you're doing is a separate popup rather than a redirect. If you want to redirect you can look at the 'Create Problem' UI action for an example in the system. If you want to adjust your code so that you get a popup you could change it to something like this that uses 'sysparm_query' to populate field values as shown here...
Populating Default Values with a URL or Module - ServiceNow Guru
function redirectToIncident(){
//Client-side get record sys_id
var sysID = g_form.getUniqueValue();
//Base URL for creating a new incident record and populating fields via 'sysparm_query' parameter
var url = '/incident.do?sys_id=-1&sysparm_query=';
//Query parameter for populating fields on the incident form. Adjust this as needed.
var urlParams = 'caller_id=' + sysID
//Pop up window
var w = getTopWindow();
w.popupOpenFocus(url + urlParams, '_blank', false, false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2015 08:21 AM
Mark,
you are correct it open the window once i added the quotes.
Thanks,
Nannette