gpt4 book ai didi

ServiceNow 重命名附件未获取 SysId

转载 作者:行者123 更新时间:2023-12-03 16:27:30 26 4
gpt4 key购买 nike

在ServiceNow中,我在业务登录-脚本操作中编写了脚本。添加和删​​除时我得到 sysId,但重命名附件时我无法获得 sys_id。

sendnotification();
function sendnotification()
{
try
{
var r = new sn_ws.RESTMessageV2('IqtrackTest', 'AttachmentPost');

r.setStringParameterNoEscape('sys_id',current.sys_id);
r.setStringParameterNoEscape('sysparm_TableName',current.getTableName());
r.setStringParameterNoEscape('Action',"Attachment_Renamed");

var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex)
{
var message = ex.getMessage();
}
}

最佳答案

试试这个

  var record = new GlideRecord('sys_attachment');
record.addQuery('user_name',gs.getUserName());
record.orderByDesc('sys_updated_on');
record.setLimit(1);
record.query();
if (record.next())
{
gs.print(record.getValue("sys_id"));
gs.print(record.getDisplayValue("file_name"));
gs.error("file name"+record.getDisplayValue("file_name"));
}

关于ServiceNow 重命名附件未获取 SysId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44498845/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com