- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2019 08:59 AM
Hello,
I have a UI action creating a knowledge article from a List View (so, you select 1 or multiple boxes on the list list view, and then there's the menu option to create a knowledge article).
I want the knowledge article short description to include the Release (release is reference field) from the list view. It is currently returning the sys id of the Release field.
I have tried to add
This is the code I have in the UI action: The line that is bold and italics is the line that populates the short description of the KB.
If I leave as is, it will return the sys id. If I put gr.release.getDisplayValue(); it does nothing at all - no article is created.
Any ideas? Thank you!
function runFunction()
{
var val = g_list.getChecked();
//alert(val);
var kbtext = '';
var kbshort_description = '';
var gr = new GlideRecord('rm_story');
gr.addQuery('sys_id','IN',val.toString());
gr.query();
while(gr.next())
{
kbshort_description = 'Stories deployed in ' + gr.release;
kbtext = kbtext+ 'Number: '+gr.number+'<br /> Short Description: '+gr.short_description +'<br/><hr/>';
// alert(kbtext);
}
var kbart = new GlideRecord('kb_knowledge');
kbart.initialize();
kbart.short_description = kbshort_description;
kbart.text = kbtext;
kbart.insert();
alert('KB article is created');
g_list.refresh();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2019 11:29 AM
Replace
kbshort_description += gr.release.getDisplayValue();
with
if(kbshort_description.indexOf(gr.release.getDisplayValue()) == -1)
kbshort_description += gr.release.getDisplayValue();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2019 11:29 AM
Replace
kbshort_description += gr.release.getDisplayValue();
with
if(kbshort_description.indexOf(gr.release.getDisplayValue()) == -1)
kbshort_description += gr.release.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2019 11:51 AM
Thank you! Perfect! I appreciate your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2019 12:40 PM
Sorry...I didn't realize that this UI Action was Client side enabled...
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!