- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2019 08:11 AM
Hello,
I'm attempting to add a related link to the Approvals table to view Knowledge articles during approvals. When approvers are reviewing the knowledge articles, they would like to see the article as it will appear when published rather than the view presented at the bottom of the approval page which is more of an editor's view. If the approver accesses the KB article in the Approving column of their approvals list, they do have a View Article related link which will open the article in a 'published' view. The update I'm attempting to complete is to add this View Article related link to the approval page so the approver does not have to click into two different screens to complete the review and approval.
I've attempted to create a new UI action to add the link to the approvals table, but I am not able to complete the script to make it reference the correct knowledge article. I have created the UI action by copying the UI action logic setup for the related link on the knowledge table, but need assistance in pointing the redirect at the correct article Sys ID from the approvals table. Can anyone assist with the script update? Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 11:31 AM
Alexandra, Brad alerted me to this community article to help provide you some guidance. Let me start by saying you are very close to a solution but one thing is tripping you up! In the script you will find "current.sys_id":
- "current" is a ServiceNow variable for the current record you are viewing.
- When this UI Action is linked to the kb_knowledge table the "current" stores all the details of that KB Article.
- When you copied it over to the sysapproval_approval table, current is now that approval record
- So when the UI Action attempts to redirect to the KB article it cannot find an article in the kb_knowledge table that has the same SysID as the sysapproval_approver record thus your issue. SysIDs should be unique across the platform given they are a random selection of 32 characters and numbers.
Let me point out something, this particular UI Action was "enhanced" in the Madrid release. If you are still on London that is OK, but if you are on Madrid or New York you are using an older version of the UI Action and you may want to check with your broader team to understand why this UI Action may have been skipped during the upgrade.
So you will have to adjust a few things to make this work, but again you are super close!
- First off the condition of the UI Action needs to change. You don't want this UI Action to show on each and every approval, only ones that are for KB Articles. Fortunately the Approval records have an attribute called "source_table" that we can reference for the condition. So change your UI Action Condition to:
-
current.source_table == "kb_knowledge"
- The script needs a few changes too again to reference the SysID of the KB Article and NOT the SysID of the approval record. I will provide 2 examples so you can get this working now but also what need to change with the Madrid/New York version of this UI Action.
- Your Version/London:
-
// redirect to view article gs.setRedirect("kb_view.do?sys_kb_id=" + current.document_id.toString());
- Madrid/New York:
-
var kbArticle = new GlideRecord("kb_knowledge"); if (kbArticle.get(current.document_id.toString())) { new global.KnowledgeUIAction().viewArticle(kbArticle,'platform'); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2019 09:26 AM
do you want to create a record for KM approval in sys_approval table?
[ Architect | Certified Professional]
Was this response helpful? If so, please mark it as ✅ Helpful and ✅ Accept as Solution to help others find answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 08:52 AM
To be honest, I'm not really sure. I think the relationship between the two tables is already established. My goal is to create a related link on the Approval record to view the approving article. Right now, when I applied the link as I shared in the screenshot, it is pulling the sys_ID for the approval creating a circular re-direct rather than re-directing to the article being approved. I'm not skilled in completing script updates so I'm not sure how to change the code to reference the article instead of the approval.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 09:45 AM
Hi Alexandra,
Instead of doing this, just open an Approval Form in Form designer and add approval summarizer as shown below: this will give you summary of Kb article for approval, same configuration i am using in my instance.
If this resolves your query, please mark my comments as correct and helpful
.
Regards,
Ajay Chavan
[ Architect | Certified Professional]
Was this response helpful? If so, please mark it as ✅ Helpful and ✅ Accept as Solution to help others find answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 09:46 AM
so this way approver would know what they are approving , no need to navigate through multiple tabs
[ Architect | Certified Professional]
Was this response helpful? If so, please mark it as ✅ Helpful and ✅ Accept as Solution to help others find answers.