Trying to redirect the helpdesk user to the incident number inside of a reference field after submitting a form.
I'm not certain if this would work (since I can't try it at the moment) but perhaps...
I'd try two ways of doing it --
So the first thing you want to do is construct the URL and save it to a string variable. That might look something like this:
var instancePrefix = "INSERT YOUR INSTANCE PREFIX HERE";
var incidentSysID = g_form.getValue('INSERT FIELD NAME HERE'); //note that this should be the actual field name, not the 'friendly' name. Something like 'u_related_inc'
var constructedURL = "http://" + instancePrefix + ".service-now.com/nav_to.do?uri=incident.do?sys_id=" + incidentSysID;
Finally, if you're doing what I recommend and changing the 'save' and/or 'update' UI actions, you just have to find the line in the UI action that says "action.setRedirectURL(current);" (if it doesn't exist, create it and put it on the first line). The change 'current' to 'constructedURL' (without the quotes, obviously).
Again, I haven't tested it, but according to this wiki article, you can also pass in a glide record pointing to the incident rather than constructing the URL. The main difference is you'd have to do a glide query and pass in the object you queried with. That's probably a more system-friendly way to do it.
So that would look something like this:
var incidentSysID = g_form.getValue('INSERT FIELD NAME HERE'); //note that this should be the actual field name, not the 'friendly' name. Something like 'u_related_inc'
var gr = new GlideRecord('incident');
gr.addQuery('sys_id', '=', incidentSysID);
gr.query();
action.setRedirectURL(gr);