Issue
To download an attachment directly for the search page while searching for a knowledge article or text file contained in a knowledge article, which is similar in functionality to $knowledge.do, follow the steps below to configure the Search Page widget and Search source to display the attachment.
Adding spAttachmentManager directive to Search Page widget
- Navigate to Service Portal > Widget
- Search for a widget named Search Page, the widget handling the searching
Link: https://<yourInstance>.service-now.com/sp_widget.do?sys_id=b8c57073cb10020000f8d856634c9cfc - In the Related list in the bottom of the page, click Edit in the Angular Providers tab.
- Search for spAttachmentManager and add it to the page.
Note: The search page does not need to be cloned to add the Angular Providers.
Using the spAttachmentManager directive in the Knowledge Search source
- Navigate to Service Portal > Portal
- Search for the Portal record to configure this feature. If using out of box portal, search for the record Service Portal
- In the related list, open the search source called Knowledge Base
Link to the OOB Search Source: https://<yourInstance>.service-now.com/sp_search_source.do?sys_id=c6170ae86721220023c82e08f585efe6 - Add the following piece of code to the Search page template to use the spAttachmentManager directive:
<sp-attachment-manager table="'kb_knowledge'" sys-id="item.sys_id" omit-edit="true"></sp-attachment-manager>