Knowledge Feedback Comments Field

NonaJohnson
Kilo Expert

I am trying to find a way to get to the data that is stored in the comments field on the table kb_feedback.  This table seems to not be extended from the task table so I have not been able to dot walk to the comments field.  Here is what I am trying to do:

  • after the user views a KB Article and decides to flag that article
  • a ui script box comes up to fill in a reason (comments field) for flagging the article
  • you fill in your reason and the data shows up on the knowledge feedback tab for that article (kb_feedback table)
  • I have created a business rule that after the knowledge article is flagged to automatically create a knowledge task.
  • on this task I am mapping the fields for the article, assignment group, adding data to the short description etc
  • I am also wanting to map the data that was added in the UI Script reason field when the article was flagged and is now on knowledge feedback
  • I can see my text in the comments field, but cannot find a way to map the data that is in the comments to the kb_task that I just created with the business rule (want to map to the description field). When I view the field it shows as kb_feedback.comments

Here is the script I am using on my business rule (is using the kb_knowledge table)

var kbtask = new GlideRecord("u_kb_task");
kbtask.initialize();
kbtask.u_knowledge_article = current.sys_id;
kbtask.short_description = "Knowledge Feedback for " + current.number;
kbtask.assignment_group = current.kb_knowledge_base.u_kb_task_group.sys_id;
kbtask.description = current.kb_feedback.comments;
kbtask.insert();

Does anyone know what mapping I can use or if since this table is not extended from the task table that it is not even possible.

Thanks

Nona Johnson

1 ACCEPTED SOLUTION

benn23
ServiceNow Employee
ServiceNow Employee

How about adding the business rule to the kb_feedback table instead?  Fire when 'flagged' is true.

var kbtask = new GlideRecord("u_kb_task");
kbtask.initialize();
kbtask.u_knowledge_article = current.article;
kbtask.short_description = "Knowledge Feedback for " + current.article.number;
kbtask.assignment_group = current.article.kb_knowledge_base.u_kb_task_group.sys_id;
kbtask.description = current.comments;
kbtask.insert();

View solution in original post

6 REPLIES 6

matt v_
Mega Expert

If I'm understanding your process correctly, I believe you'd need to query the record on that kb_feedback table where the article is equal to the one this task is for.  Then you can set the kb_feedback comments field to a new variable and add that to your kbtask description.

NonaJohnson
Kilo Expert

Thank you for your response - where in my current script do you suggest I setup the query? After the initialize or at the end.

Nona Johnson

NonaJohnson
Kilo Expert

Have been trying several queries and none are working - do you have a possible example you can send me.  Appreciate any help you can give me.

Thanks

 

benn23
ServiceNow Employee
ServiceNow Employee

How about adding the business rule to the kb_feedback table instead?  Fire when 'flagged' is true.

var kbtask = new GlideRecord("u_kb_task");
kbtask.initialize();
kbtask.u_knowledge_article = current.article;
kbtask.short_description = "Knowledge Feedback for " + current.article.number;
kbtask.assignment_group = current.article.kb_knowledge_base.u_kb_task_group.sys_id;
kbtask.description = current.comments;
kbtask.insert();