- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 06:24 AM
Hi All,
im trying to retrive the attachment through emai script. im able to do it as a link but when i try attaching it , it will retrive all attchment in the record instead of the one which i quuired for.
Here is the mail script please let me what's wrong
var attachcontent = attachment.getContent(gr.sys_id);
attachment.write(current, name, gr.getValue('content_type'),attachcontent);
new GlideSysAttachment().writeContentStream(current, gr.getValue('file_name'), gr.getValue('content_type'), content);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:04 PM
then you need to use BR on sys_email table
script something like this so that it includes only 1 file. This has worked for me in past
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 07:55 AM
email notification is on which table?
is it on u_mservice_case table?
if yes then you can use Include attachment checkbox and it will send the file on email and no scripting is required
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:40 AM
@Ankur Bawiskar , thanks for the reply, but i don't want all the attachment which is present on record. example i have 2 files on record file 1 and file 2, i would like to add only the file1 in my mail which contains sap notification number in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:04 PM
then you need to use BR on sys_email table
script something like this so that it includes only 1 file. This has worked for me in past
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:14 PM
@Ankur Bawiskar thank you for the help..