Newer Version Available

This content describes an older version of this product. View Latest

Update an Article Viewstat with SOQL

Determine how many hits a Salesforce Knowledge article has had by using the UPDATE VIEWSTAT optional clause on a SOQL query. You can get a view count for every article that you have access to online.

The UPDATE VIEWSTAT clause is used in a SELECT statement to report on Salesforce Knowledge article searches and views. It allows developers to update an article’s view statistics.

You can use this syntax to increase the view count for every article you have access to online:

1SELECT Title FROM FAQ__kav
2   WHERE PublishStatus='online' and
3   Language = 'en_US' and
4   KnowledgeArticleVersion = 'ka230000000PCiy'
5   UPDATE VIEWSTAT