ServiceNow 将用户重定向到提交后在参考字段中输入的事件
ServiceNow redirect user to incident entered in reference field after submit
尝试在提交表单后将帮助台用户重定向到参考字段内的事件编号。
我不确定这是否可行(因为我目前无法尝试)但也许...
我会尝试两种方法 --
- 您可以修改 'Save' and/or 'Update' UI 操作(我推荐)。
- 您也许可以创建一个 'client script' 来使用 document.redirect();类型的东西。我不太推荐这个。
所以您要做的第一件事是构造 URL 并将其保存到字符串变量中。这可能看起来像这样:
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;
最后,如果您按照我的建议进行更改 'save' and/or 'update' UI 操作,您只需在 UI 表示 "action.setRedirectURL(current);" 的操作(如果它不存在,请创建它并将其放在第一行)。将 'current' 更改为 'constructedURL'(显然没有引号)。
同样,我还没有测试过,但是根据this wiki article,你也可以传入一个指向事件的滑行记录,而不是构造URL。主要区别在于您必须执行滑动查询并传入您查询的对象。这可能是一种对系统更友好的方式。
所以看起来像这样:
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);
尝试在提交表单后将帮助台用户重定向到参考字段内的事件编号。
我不确定这是否可行(因为我目前无法尝试)但也许...
我会尝试两种方法 --
- 您可以修改 'Save' and/or 'Update' UI 操作(我推荐)。
- 您也许可以创建一个 'client script' 来使用 document.redirect();类型的东西。我不太推荐这个。
所以您要做的第一件事是构造 URL 并将其保存到字符串变量中。这可能看起来像这样:
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;
最后,如果您按照我的建议进行更改 'save' and/or 'update' UI 操作,您只需在 UI 表示 "action.setRedirectURL(current);" 的操作(如果它不存在,请创建它并将其放在第一行)。将 'current' 更改为 'constructedURL'(显然没有引号)。
同样,我还没有测试过,但是根据this wiki article,你也可以传入一个指向事件的滑行记录,而不是构造URL。主要区别在于您必须执行滑动查询并传入您查询的对象。这可能是一种对系统更友好的方式。
所以看起来像这样:
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);