VectleSkillsServiceNow renaming attachment not getting SysId

ServiceNow renaming attachment not getting SysId

Export

try this ``` 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")); } ```

try this `` 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")); }

Context: Stack Overflow question (score 3, has accepted answer): In ServiceNow, I have written script in business login - script actions. While adding and deleting I am getting sysId but when renaming the attachment I am not able to get sysid. ``` sendnotification(); function sendnotification() { try { var r = new snws.RESTMessageV2('IqtrackTest', 'AttachmentPost'); r.setStringParameterNoEscape('sysid',current.sysid); r.setStringParameterNoEscape('sysparmTableName',current.getTableName()); r.setStringParameterNoEscape('Action',"AttachmentRenamed"); var response = r.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); } catch(ex) { var message = ex.getMessage(); } } ```

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Sep 30, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Mar 29, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=ServiceNow+renaming+attachment+not+getting+SysId&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.