- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2023 03:29 AM
Hi Guys,
I'm doing an business rule on "after" , insert on Kb_knowledge Table, when a new KB is created I need to write a new record on m2m_connected_content, because I need to attach a kb to the current topic on employee( topic and kb_base have the same name). From the log i retrieve correctly the variables, but the record didn't created on m2m and i have this error : " ErrorContent can not be associated to the same topic more than once. "
Here the Code of my Business rule:
(function executeRule(current, previous /*null when async*/ ) {
gs.log("m2m_connectedINIZIO");
/***********************************/
var knowledgeBaseName = current.kb_knowledge_base.getDisplayValue();
var knowledgeBaseId = current.kb_knowledge_base.sys_id;
var topicGR = new GlideRecord('topic');
topicGR.addQuery('name', knowledgeBaseName);
//topicGR.addQuery('sys_id', knowledgeBaseId);
topicGR.query();
gs.log("m2mQuery " + topicGR.addQuery('name', knowledgeBaseName));
gs.log("m2mQueryID " + topicGR.addQuery('sys_id', knowledgeBaseId));
if (topicGR.next()) {
var topicName = topicGR.name;
var topicSysId = topicGR.sys_id;
}
gs.log("m2mTopicNAME: " + topicName); //ok
gs.log("m2mTopicSYSID: " + topicSysId); //ok
if (topicGR.isValid()) {
var m2mGR = new GlideRecord('m2m_connected_content');
m2mGR.initialize();
//m2mGR.newRecord();
m2mGR.topic = topicSysId;
m2mGR.content_type = '4c32a92153622010069addeeff7b12a3';
m2mGR.knowledge = knowledgeBaseId;
m2mGR.insert();
gs.info("Nuovo record inserito in m2m_connected_content");
gs.log("m2mASSEGNATOPIC: " + m2mGR.topic); //Ok
gs.log("m2mKnowledge: " + m2mGR.knowledge); //Ok
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2023 04:02 AM
You can associate content from multiple knowledge categories to a topic in the taxonomy.
Refer below docs link -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2024 05:36 AM
Hi @Dario
Thank you for your swift reply. Here is our code: (on After)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2024 05:53 AM
Hi Firat,
I think the problem is that
m2mRecord.setValue('content_type', '4c32a92153622010069addeeff7b12a3');
actually this is a sys_id of my Content type field on m2m_connected_content . So i think you need to create a your content type and try to put there the sys_id.
Let me know ,
Dario
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2024 05:55 AM - edited ‎01-26-2024 05:56 AM
That is the OOTB sys_id, so same for us as well. The problem for us is the first column on my SS, it has always the same name and therefore, system sees the duplicate entry. We could not find a way to update correctly that first column.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2024 05:58 AM
On Which Table the Business Run ? My Br runs on Kb_knowledge table .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 03:59 AM
Yes, kb_knowledge as well!