- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hi ,
we have requiremnet ,in the widget we need to show knowledge article URL ,it shold open instance specific console view of the article.
Please help how we can write this validation in the Widget code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
standard console view for a knowledge article looks like:
https://<INSTANCE>.service-now.com/x/now/knowledge/article/<ARTICLE_SYS_ID>
Replace <INSTANCE> with the dynamic instance URL, and <ARTICLE_SYS_ID> with your article’s sys_id value.
Server Script Example (for Widget):
(function() {
var sysId = input.articleSysId; // Pass this from your widget options/params or GlideRecord
data.instanceUrl = gs.getProperty('glide.servlet.uri');
data.articleUrl = data.instanceUrl + 'x/now/knowledge/article/' + sysId;
})();
HTML
<div>
<a ng-href="{{data.articleUrl}}" target="_blank">
View Knowledge Article
</a>
</div>
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
even I don't have that property but it will give you the instance URL
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
standard console view for a knowledge article looks like:
https://<INSTANCE>.service-now.com/x/now/knowledge/article/<ARTICLE_SYS_ID>
Replace <INSTANCE> with the dynamic instance URL, and <ARTICLE_SYS_ID> with your article’s sys_id value.
Server Script Example (for Widget):
(function() {
var sysId = input.articleSysId; // Pass this from your widget options/params or GlideRecord
data.instanceUrl = gs.getProperty('glide.servlet.uri');
data.articleUrl = data.instanceUrl + 'x/now/knowledge/article/' + sysId;
})();
HTML
<div>
<a ng-href="{{data.articleUrl}}" target="_blank">
View Knowledge Article
</a>
</div>
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Ankur Bawiskar ,
Thank you for the update.In my instance we don't have glide.servlet.uri system property. We have instance_name ,value is xyzdev .Please help with this,how the server code need to be write for this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
even I don't have that property but it will give you the instance URL
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @Rajyalakshmi ,
Custom widget for link generation-
In a custom widget, you can dynamically generate the URL for a knowledge article. The typical Service Portal
URL for a knowledge article is in the format:
https://<instance_name>.service-now.com/sp?id=kb_article&sys_id=<sys_id_of_article>
Also check the below link
https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434007
Supriya Waghmode |ServiceNow Consultant