Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 03:31 AM
Hello,
I have 2 fields in the kb form to get statistics value of KB title and Article. Can someone help me on this?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 04:27 AM
Hi @Rajanandhini Ra ,
Try to use below script and set your values as the variables. Below is sample script to get the counts.
var ka = new GlideRecord('kb_knowledge');
ka.get('3f2077cf53022200d901a7e6a11c08e4'); //kb article sys id
var title = ka.short_description.toString();
var titleWordCount = title.split(" ").length;
var content = ka.text.toString();
var contentWordCount = content.split(" ").length;
gs.info("Title Word Count: " + titleWordCount);
gs.info("Content Word Count: " + contentWordCount);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 04:27 AM
Hi @Rajanandhini Ra ,
Try to use below script and set your values as the variables. Below is sample script to get the counts.
var ka = new GlideRecord('kb_knowledge');
ka.get('3f2077cf53022200d901a7e6a11c08e4'); //kb article sys id
var title = ka.short_description.toString();
var titleWordCount = title.split(" ").length;
var content = ka.text.toString();
var contentWordCount = content.split(" ").length;
gs.info("Title Word Count: " + titleWordCount);
gs.info("Content Word Count: " + contentWordCount);