How to set URL within javascript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2020 12:35 AM
Hi,
I have a URL type field and I would like to set knowledge base article.
For example, I would like to show as per following KB012345
How do I achieve this using javascript within Workflow?
I have the following script
var instance = gs.getProperty('glide.servlet.uri');
var kbnumber = 'KB001234';
var kburl = instance + "kb_view.do?sysparm_article=" + kbnumber;
<a href="kburl" target="_blank">KB001234</a>
- Labels:
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2020 12:38 AM
Hi
check the solution here, it should work:
https://community.servicenow.com/community?id=community_question&s
If I have answered your question, please mark my response as correct and helpful so that others with the same question in the future can find it quickly and that it gets removed from the unanswered list.
Thank you very much
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2020 01:50 AM
Hi Alberto, thanks for the link. however it doesn't work. Possibly due to URL field type.
This is my script
var instance = gs.getProperty('glide.servlet.uri');
var kbnumber = 'KB0011609';
var kburl = instance + "kb_view.do?sysparm_article=" + kbnumber;
var setkblink = '[code]<a href="' + kburl + '" target="_blank">' + kbnumber + '</a>[code]';
g_form.setValue('u_kbarticle', 'setkblink', 'kbnumber');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2020 02:01 AM
Hi,
you can insert HTML content in work notes using [code] but not in URL field
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2020 12:47 AM
Hi,
So you want to update the URL field from workflow script
URL field can only hold url
please explain in detail what exactly is required
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader