- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 11:34 PM
Hello,
I used the widget 'Ticket Attachments' in Service Portal of Helsinki.
In this widget there is an element which call 'now-attachments-list'.
I want to understand what the meaning of this element, maybe it's a directive of angular? so, where it's defined?
I would be happy if someone can explain me what is it exactly.
thanks,
Michal
Solved! Go to Solution.
- 10,932 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 03:53 AM
Michal,
I apologize that my answer was not clear. When I stated that it was on the ServiceNow side, I meant that it's not directly accessible to us. It's directly accessible to ServiceNow employees on their side. You won't find it under any Module, Angular Providers or dependency sections.
That said, it doesn't mean you can't get to it. With a closer look by doing an Inspection, you can see how the directive is defined.
Here is the directive script:
angular.module('sn.common.attachments').directive('nowAttachmentsList', function(getTemplateUrl) {
'use strict';
return {
restrict: 'E',
replace: true,
templateUrl: getTemplateUrl("attachments_list.xml"),
link: function(scope, elem, attrs, $parse) {
scope.icons = {
preview: attrs.previewIcon,
edit: attrs.editIcon,
delete: attrs.deleteIcon,
ok: attrs.okIcon,
cancel: attrs.cancelIcon
};
scope.listClass = "list-group";
var inline = scope.$eval(attrs.inline);
if (inline)
scope.listClass = "list-inline";
scope.entryTemplate = getTemplateUrl(attrs.template || "attachment");
}
};
});
;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 01:30 PM
I'm not sure I understood, but my question is: I see "attachment" object is used to loop through the attachments and you reported the fields it is composed by. Is such definition extendable with other fields?
Since I'm here ... another question if I can 🙂
I customized the custom_entry adding a "select" (aka a choice) that is displayed for each attachment but whenever I choose a value for an attachment, all the other are valued the same 😞 how can I fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 06:48 AM
If you're asking if it is possible to modify the provided attachment object directly from it's original code. I'd say no.
However, since you're making a custom directive you can extend what displays and add to that leveraging what's already given or creating your own attachment handler.
For your select, I don't know the answer or at least I can't give an honest evaluation without actually seeing what you did.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 07:27 AM
Thank you so much Chris!
> However, since you're making a custom directive you can extend what displays and add to that leveraging what's already given or creating your own attachment handler.
I was considering creating my custom attachment handler relying/copying on what's already present OOTB but I don't get where the attachment object is defined so that I can create my own version in my own handler!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 07:35 PM
Hi Edoardo,
It really isn't necessary to know how the attachment object is created to make your own.
There are only a few fields on the attachment table OOTB. The main values needed to get an attachment are the table your on and the sys_id of the record. With that information you can get the things needed for displaying attachments. And all this is already given in the attachment widget (currently I'm looking at the latest for Standard Tickets)
With that said. I don't think the "how" the attachment object is created is readily available in the SN instance by the UI. But you can get the script by using the developer tools of your browser just like most websites.
I mainly use Firefox, so when I do an inspect element I look in the Debugger tab, then under the Sources tab. From there I open the scripts folder. You'll find a script called: js_includes_sp.js. In that file do a search for the nowAttachmentHandler factory or even just attachment and you'll find all the scripts you need to see how they went about creating the nowAttachmentHandler which is providing the attachment object in the widget.
As a shortcut you can append this at the end of your instance url to go directly to the includes file: "/scripts/js_includes_sp.js"
for example: https://<yourinstancename>.service-now.com/scripts/js_includes_sp.js
I hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 09:54 PM