- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 05:51 AM
Hello.
I have a Record Producer that is set to kick off an Incident in some situations and a Request in other situations, depending on the value of a variable.
That part of the process (i.e. kick off Incident or Request) is working as expected.
My issue is that if there is an attachment and it is kicking off a Request then the attachment does not get added to the Request (in sys_attachments table it shows the attachment being associated with the Incident table).
Anyone have any ideas on how I can set it so that if a Request is being kicked off that the attachment comes with it?
Thank you!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 06:05 AM
Hi Tom, Sorry I didn't realise you replied.
From your shared script there are a few issues.
- When creating request management records, I'd really push to using the CartJS API as to create records how SN intends CartJS | ServiceNow Developers
- Attachments are transient before they're set to their final record destination.
You can use the following, after you have the newly redirected target record defined, to move the attachments
var attachment = new GlideSysAttachment();
var agr = attachment.getAttachments(current.getTableName(), current.getUniqueValue());
while(agr.next()){
agr.setValue('table_name' , '');
agr.setValue('table_sys_id' , '')
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 06:09 AM
Are you able to share how you're targeting two tables in a record producer? My asumption is you're aborting the current action and targeting a different table, for which the attachments won't know where to end up.
A native solution to this is ServiceNow's universal request module which allows you to have a "primary" ticket above business-process specific task types
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 06:13 AM
Hi Kieran. I am using "current.setAbortAction(true);" to get it to stop from kicking off an Incident and instead creating a Request - does that answer your question?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 07:33 AM
Can you share the full code being used in your record producer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 07:57 AM