open kb directly instead of opening kb form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 03:57 AM - edited 08-01-2024 03:58 AM
Hi all,
I have related list in RITM which shows related kb articles attached to RITM, So when ever user clicks on kb article from related list it should directly open published artcile instead of opening kb form in new window.
This screen should be avoided
This screen should be opened.
pls assist me how to acheive this,
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 06:29 AM
Hi,
Yes, it is possible to open a Knowledge Article directly to the attachment without opening the form in ServiceNow.
1. Create a UI Action: Go to "System Definition" > "UI Actions" and create a new UI Action with the following settings:
Table: kb_knowledge (Knowledge Article table)
Action name: open_attachment_directly
Client: true
2. Navigate to "System Definition" > "UI Scripts" and create a new UI Script with the following code:
function openAttachmentDirectly() { var knowledgeSysID = g_form.getValue('sys_id'); // Get the current Knowledge Article's sys_id var attachmentSysID = g_form.getValue('u_attachment_field'); // Replace 'u_attachment_field' with the actual field name storing the attachment sys_id if (attachmentSysID) { var attachmentUrl = new GlideURL('sys_attachment.do'); attachmentUrl.addParam('sys_id', attachmentSysID); attachmentUrl.addParam('sysparm_referring_url', 'kb_knowledge.do?sys_id=' + knowledgeSysID); window.open(attachmentUrl.getURL()); } else { alert('No attachment found.'); } }
3. Add the UI Action to the form layout: Edit the form layout of the Knowledge Article table (kb_knowledge) and include the newly created UI Action, "Open Attachment Directly."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 10:10 PM - edited 08-01-2024 10:14 PM
Hi @NileshP
Actually it should open from related list the related list is in RITM. i have attached a screen shot for refference.
i didn't get 3rd point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 02:28 AM - edited 08-02-2024 03:55 AM
@Ankur Bawiskar, @Brad Tilton,@Community Alums please provide solution for this.