- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 06:55 AM
Hi All,
I have a scheduled job which will create an attachment in the same job record, is there any other way to get the sys_id of the scheduled job from its own script area:
The below script is hardcoded with the Scheduled job sys_id :
var attach=new Attachment();
var tablename='sysauto_script';
var sysid = '9506eab2dbac84506422138b4b9619b2';
var attachment = new GlideSysAttachment();
var agr = attachment.getAllAttachments(tablename, sysid);
attach.write(tablename,sysid,"SN1241_number_of_records.html", 'html', msg);
Is it possible to use any object or API to get the sys_id of the Scheduled job from its script area?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 06:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 06:58 AM
Hi,
You can try: getUniqueValue
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_ScopedGlideRecordGetUniqueValue
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 06:58 AM
Have you tried using current.getUniqueValue()?