Resetting News Article Views

MeganCox
Tera Expert

If we are doing a rebrand of our News Article formats, is there a way to reset the view count on the news article? I checked in the content record and can see the views there. I thought maybe I could just click the people and delete, but that option is greyed out. 

Is there any other way than cloning each article and setting the old ones inactive?

9 REPLIES 9

GlideFather
Tera Patron

ahoy @MeganCox,

 

I just verified in my PDI, it is pretty simple. You navigate to the [kb_knowledge] table and each of the articles have View count and you just erase that number (change to 0) and it will annulate it, not possible to do so manually but a background script worked.

 

Add View count field on the table list view, navigate to :

https://yourinstance.service-now.com/now/nav/ui/classic/params/target/kb_knowledge_list.do

GlideFather_2-1780040168904.png

(it is not possible to manually erase it but in case you want to export it for backup purposes)

 

BEFORE deleting the count by a script, an article has 97 views

GlideFather_0-1780039915186.png

 

AFTER deleting the count by a script, 1 view (because I reloaded the page myself)

GlideFather_1-1780039931708.png

 

The background script I used for inspiration, you might want to optimise it and build a new query/filter conditions but for testing in your PDI or non-prod instance this will do the trick! 

var grKK = new GlideRecord('kb_knowledge');
grKK.addEncodedQuery("numberSTARTSWITHKB0000028");
grKK.orderByDesc('number');
grKK.setLimit(100);
grKK.query();
while (grKK.next()) {
    
   grKK.sys_view_count = '0';
   grKK.update();
}

 

Tip: maybe before you annulate the view count for multiple articles, add the column to list view and export it to excel just in case..

---
Where the rules are real, you'll find me

Now I'm looking specifically for news article content that has been created. does that live on the knowledge table? 

@MeganCox,

 

how do you define "news article"? Is it a type, a category or what's that?

 

I never heard of such attribute, it might be related to dedicated terminology or plugin that I am not familiar with ://

 

When you have a list of ALL articles, how do you know which is news and which is not? Based on this conditions you can build a query and adjust the background script I shared above and it is already solution to your query. Let me know if that helped

---
Where the rules are real, you'll find me

MeganCox_0-1780317390266.png

It's a specific piece of content you can add in EC.