- 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
06-28-2024 04:04 AM
Hi @Nandini DM
Not sure, why you want to duplicate the functionality. In Inc we have check box if that tick / true an article get created. I can understand you have specific need but request you to see if you can modify that Check box module for yoru need.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- 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-03-2024 05:55 AM
Thank you Bhavya 😀
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 05:35 AM
Welcome😄