- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 03:46 AM
Hello,
We have a new template named "Incident article" that needs to be used when creating a knowledge article directly from an incident via button. Same as with a problem when creating a know error from problem form
How to achieve this using UI Action ?
Kindly help!
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 04:48 AM
Hi @Nandini DM,
Please create the UI action on incident table as "Incident article" if you want to show for specific state then add that in condition field like below
UI action :
script
function confirmArticle() { // this is called from onclick fucntion
var answer = confirm("Are you sure you want create Knowledge from this incident.");
if (answer == true) {
gsftSubmit(null, g_form.getFormElement(), 'kbcidents');//kbcidents -this is action name of ui action
} else {
return false;
}
}
if (typeof window == 'undefined')
createKbFromIncident();
function createKbFromIncident() {
var kbGr = new GlideRecord("kb_knowledge"); //copy the required fields that you want to show in the article
kbGr.initialize();
kbGr.source = current.sys_id;
kbGr.short_description = current.short_description;
kbGr.text = kbGr.current.description;
kbGr.insert();
var link = '<a href="' + kbGr.getLink() + '">' + kbGr.getValue('number') + '</a>';
var message = gs.getMessage('Knoweldge article cereated') + ' ' + link + ' ';
gs.addInfoMessage(message); // this will display info message saying " Knoweldge article cereated KBnumber which has the link so that you direclty open from the incident.
action.setRedirectURL(current);
}
output :
Do the same for Problem table.
If my solution helps you any way then mark it as accepted and helpful.
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 12:21 AM - edited 07-25-2024 12:22 AM
Thank You @Bhavya11 . Solution works perfect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 05:33 AM
Welcome 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 11:02 PM
I got this error, please Bhavya can you help me in this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 08:21 PM
Hi @ayanshnamde ,
open the ui action that you created please check the Action name field on that like in my case it is 'kbcidents'
In the UI Action script, you need to pass the same name
If my solution helps you any way then mark it as accepted and helpful.
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 02:22 AM
Thanks, Bhavya it is working fine now.