【问题标题】:ServiceNow REST POST create WorkNote format textServiceNow REST POST 创建 WorkNote 格式文本
【发布时间】:2019-05-23 07:23:57
【问题描述】:

设置我的请求正文

request.setRequestBody("{\"work_notes\":\"After the Comma,\\\\nNew line\"}");

我尝试在创建事件时创建工作笔记。到目前为止,这可行,但我在格式化文本时遇到问题。例如在这种情况下,在逗号之后我想要一个新行。使用 \n 似乎不起作用。

结果:

代码:

    var request = new sn_ws.RESTMessageV2();
    request.setEndpoint('https://my-instance.service-now.com/api/now/table/incident');
    request.setHttpMethod('POST');    

    var user = 'admin';
    var password = 'admin';

    request.setBasicAuth(user,password);
    request.setRequestHeader("Accept","application/json");
    request.setRequestHeader('Content-Type','application/json');
    request.setRequestBody("{\"work_notes\":\"After the Comma,\\\\nNew line\"}");
    var response = request.execute();
    gs.log(response.getBody());

【问题讨论】:

    标签: json unicode servicenow


    【解决方案1】:

    我可以解决它

    [code]文字
    更多文字[/code]

    作为语法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      • 2022-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-15
      • 1970-01-01
      相关资源
      最近更新 更多