- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 07:17 AM
Hi Team,
How can i achieve the below requirement.
When the agent attaches the attachment to ServiceNow, a link to the attachment should get added to work notes.
Any help would be highly appreciated .
Thanks in Advance.
Regards
Deepak Bisht
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2020 02:24 AM
Hi,
then use this but it won't be clickable link unless you give anchor tag
I have not used anchor tag in below code
var rec = new GlideRecord(current.table_name);
rec.get(current.table_sys_id);
var url = 'https://' + gs.getProperty('instance_name') + '.service-now.com/sys_attachment.do?sys_id=' + rec.sys_id;
rec.work_notes = url;
rec.update():
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 07:28 AM
Hi,
you can write after insert BR on sys_attachment table
Note: this change will be seen once user refreshes the form
Condition: current.table_name == 'incident'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rec = new GlideRecord(current.table_name);
rec.get(current.table_sys_id);
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + current.getTableName() + '.do?sys_id=' + current.sys_id + '">' + rec.getDisplayValue() + '</a>';
rec.work_notes = '[code]' + url + '[/code]';
rec.update():
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 09:05 PM
Thanks for marking my response as helpful.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 09:13 PM
Hi Ankur,
Thanks for the reply .
I am very close to it.i got the work notes updated with incident no (Which is Hyperlink) so whenever i am clicking on it , it directing me to homepage screen page and then giving me options for attachment.
Below are my ask
1. I need Explicitly URL so that i can transfer it to someone ( so that if someone want they access the attachment by just clicking )??
2. I don't want to redirect it to Homepage , i want it to be on same page??
is this achievable?
Waiting for your comment
Regards
Deepak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 09:38 PM
Hi,
whenever you show attachment link and user clicks that and they are logged into the instance the file will get auto downloaded
for explicit attachment link do this
var url = '<a href="' + '/' + current.getTableName() + '.do?sys_id=' + current.sys_id + '">' + rec.getDisplayValue() + '</a>';
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader