In the modern age of facebook and social media, users are often used to seeing thumbs up and down when they like or dislike things. ServiceNow Knowledge articles have a feature to rate an article for it’s usefulness/helpfulness. The little UI Macro change here changes the yes and no answer to thumbs up and thumbs down.
Firstly The UI Macro we are concerned with here isĀ ‘kb_view_ratings’.
Before you go in all guns blazing, I’d recommend you make a copy of this UI Macro to preserve it should you want to return to the OOB version at a later date.
Once you’ve made a copy and renamed the original you can go ahead and make the changes. Below are two code excerpts, the first is the original code and second is the altered code. I’ve highlighted the two lines you are going to change (121 & 122)
Original Code
119 120 121 122 123 124 125 126 |
<span class="kb-article-yn-label">${gs.getMessage('Helpful?')}</span> <span class="kb-article-yn-box"> <button class="btn btn-success-subdued kb-article-yes-btn" onclick="kbArticleRating.feedback('yes')">${gs.getMessage('Yes')}</button> <button class="btn btn-destructive-subdued kb-article-no-btn" onclick="kbArticleRating.feedback('no')">${gs.getMessage('No')}</button> <j2:if test="$[jvar_useful_percentage > 0]"> <span class="kb-article-yn-percentage">${gs.getMessage("{0}% found this useful", '${jvar_useful_percentage}')}</span> </j2:if> </span> |
Updated Code
119 120 121 122 123 124 125 126 |
<span class="kb-article-yn-label">${gs.getMessage('Helpful?')}</span> <span class="kb-article-yn-box"> <button class="btn btn-success-subdued kb-article-yes-btn" onclick="kbArticleRating.feedback('yes')"><span class="glyphicon glyphicon-thumbs-up"/></button> <button class="btn btn-destructive-subdued kb-article-no-btn" onclick="kbArticleRating.feedback('no')"><span class="glyphicon glyphicon-thumbs-down"/></button> <j2:if test="$[jvar_useful_percentage > 0]"> <span class="kb-article-yn-percentage">${gs.getMessage("{0}% found this useful", '${jvar_useful_percentage}')}</span> </j2:if> </span> |