ServiceNow将用户重定向到提交后在参考字段中输入的事件

时间:2015-05-20 22:16:33

标签: redirect servicenow

在提交表单后,尝试将帮助台用户重定向到参考字段内的事件编号。

1 个答案:

答案 0 :(得分:0)

我不确定这是否有用(因为我现在无法尝试),但也许......

我尝试了两种方法 -

  1. 您可以修改'保存'和/或'更新' UI动作(我推荐)。
  2. 您可以创建一个客户端脚本'这是使用document.redirect();事物的类型。我不推荐这么多。
  3. 所以你要做的第一件事就是构造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;
    

    最后,如果您正在按照我的建议进行操作并更改“保存”。和/或“更新”#39; UI动作,你只需要在UI动作中找到" action.setRedirectURL(current);" (如果它不存在,则创建它并将其放在第一行)。改变现状'到' constructURL' (显然没有引号)。

    同样,我还没有对它进行测试,但根据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);