Create KB from INC/RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hello All,
We have a requirement where
- Check if the INC or RITM is assigned to groupa or groupb.
- When the INC/RITM is resolved /close completed, display dialog if they wnat to create a KB for that ticket
- if user says yes then create KG or open KB portal with the specified category
Looking for help and steps to achieve this.
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
then simply handle this in the OOTB BR on incident table which does this
Add condition for Group A or Group B in the BR
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @Ankur Bawiskar ,
Thank you for the Information . Few points :
- I created a client script for this purpose.(attaching screenshot).This worked for our requirement. (Attaching screen shot)
- Looking at other options more , noticed that in SOW, on opening an incident in related records, there is an option "Attached Knowledge".
On selecting this option , there is a "New" button where you can create the KB. (Attaching screen shots. ) This feature is available for all groups . I followed the KB you provided, installed the plugin on our test instance to check if this option will address our requirement, and updated the Business Rule as suggested. However, I’m not seeing any changes.
Currently, the Attach Knowledge option is still available to all groups, and the expected behavior is not occurring. Specifically, when the assignment group is GroupASN or GroupBSN and the incident is resolved, the system should prompt the user to create a Knowledge article. If the user selects “Yes,” it should open a new KB record with the Knowledge Base set to SN Doc.
After installing the plugin and changing the BR by adding conditions, We don't see the required behavior.
Please let me know if something is missed?
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @CV1 ,
I tried your problem in my PDI please check below solution
I created a Client script OnChange - state and added below code
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var sysId = g_form.getUniqueValue();
alert("Here");
// Incident states
if (newValue != 6 && newValue != 7){
alert("State is " + newValue);
return;
}
var ga = new GlideAjax('CreateKBArticle');
ga.addParam('sysparm_name', 'shouldPromptKB');
ga.addParam('sysparm_table', "incident");
ga.addParam('sysparm_sys_id', sysId);
ga.getXMLAnswer(function(answer) {
alert("Inside Answer = " + answer);
if (answer !== 'true')
return;
var ask = confirm("Do you want to create a Knowledge Article for this ticket?");
if (ask) {
openKB();
}
});
}
function openKB() {
var url =
'/kb_knowledge.do?sys_id=-1' +
'&sysparm_query=' +
'kb_knowledge_base=a7e8a78bff0221009b20ffffffffff17' +
'^kb_category=ed1c2552ff0131009b20ffffffffff65' +
'^source=' + g_form.getUniqueValue();
g_navigation.open(url);
}
I created a Script Include, client callable and added below code
var CreateKBArticle = Class.create();
CreateKBArticle.prototype = Object.extendsObject(AbstractAjaxProcessor, {
shouldPromptKB: function () {
var table = this.getParameter('sysparm_table');
var sysId = this.getParameter('sysparm_sys_id');
var gr = new GlideRecord(table);
if (!gr.get(sysId))
return "false";
var allowedGroups = [
'8a4dde73c6112278017a6a4baf547aa7',
'287ee6fea9fe198100ada7950d0b1b73'
];//software, database
if (!gr.assignment_group || allowedGroups.indexOf(gr.assignment_group.toString()) === -1)
return "false";
if (table === 'incident') {
if (gr.state != 6 && gr.state != 7) // Resolved / Closed
return "false";
}
if (table === 'sc_req_item') {
if (gr.state != 3) // Closed Complete
return "false";
}
return "true";
},
type: 'CreateKBArticle'
});
Result
Currently this Inc is in IN Progress state when I change to Closed it ask me create KB Article
It will navigate me to KB Article
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
