- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2017 09:21 PM
Hi,
if i clicked YES or NO button in KB ARTICLE then immediately display POP-UP box(message box) with message- Thanks for Visiting
OR
Make Comments box mandatory .
for this i tried to check UI Macro's(it is in readonly) , UI pages but i am unable to understand where need to do changes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2017 12:51 AM
Hi Kishore,
yes this should be possible.
just as on click of yes you added an alert same can be done for No as well.
you need to add if else condition in the script.
I have tested and it is working fine.
Modify the code as per below screenshot.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2017 12:53 AM
Hi Ankur,
i just treing to display Alert box message
, when i click on YES- then display " Thanks for Visiting"
NO - then display " Please provide your feedback" can we able to change the
i am unable to understand where i have to change script here
Script:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate var="jvar_not_important" expression="
var show_kb_menu = gs.getProperty('glide.knowman.show_kb_menu', 'true');
var roles = gs.getProperty('glide.knowman.show_kb_menu.roles');
if (roles == null || roles == '')
;
else {
var hasRole = gs.hasRole(roles);
if (hasRole == false)
show_kb_menu = false;
}
"/>
<j2:if test="$[show_kb_menu]">
<j2:if test="$[sysparm_media != 'print']">
<g2:evaluate var="jvar_not_important" expression="
var show_kb_rating_options = gs.getProperty('glide.knowman.show_rating_options','true');
var roles = gs.getProperty('glide.knowman.show_rating_options.roles');
if (roles == null || roles == '')
;
else {
var hasRole = gs.hasRole(roles);
if (hasRole == false)
show_kb_rating_options = false;
}
"/>
<g2:evaluate var="jvar_not_important" expression="
var show_kb_yn_rating = gs.getProperty('glide.knowman.show_yn_rating','true');
var roles = gs.getProperty('glide.knowman.show_yn_rating.roles');
if (roles == null || roles == '')
;
else {
var hasRole = gs.hasRole(roles);
if (hasRole == false)
show_kb_yn_rating = false;
}
"/>
<g2:evaluate var="jvar_not_important" expression="
var show_user_feedback = gs.getProperty('glide.knowman.show_user_feedback') == 'onclick';
var roles = gs.getProperty('glide.knowman.show_user_feedback.roles');
if (roles == null || roles == '')
;
else {
var hasRole = gs.hasRole(roles);
if (hasRole == false)
show_user_feedback = false;
}
"/>
<j2:if test="$[show_kb_rating_options]">
<script>
function KbArticleRatingClass() {
var THANK_YOU = "${gs.getMessage('Thank you')}";
var currentId = '$[JS:knowledgeRecord.sys_id]';
function ajaxPost(value) {
if (currentId) {
var ajax = new GlideAjax('KBAjaxSNC');
ajax.addParam('sysparm_type', 'saveUseful');
ajax.addParam('sysparm_useful', value);
ajax.addParam("sysparm_article_id", currentId);
var query = $j('#sysparm_search');
ajax.addParam('sysparm_search', (query.length) ? escape(query.val()) : '');
ajax.getXML();
}
}
function feedback(value) {
// animation
$j('.kb-article-yn-box').hide();
alert("Please Provode Your feedback in COMMENTS BOX ");
var label = $j('.kb-article-yn-label');
label.animate({opacity: 0}, 600, function() {
label.text(THANK_YOU);
}).animate({opacity: 1}, 600, function() {
setTimeout(function(){
$j('.snc-article-footer-section-ratings').animate({
height: 0,
opacity: 0
}, 600);
}, 1250);
});
ajaxPost(value);
}
return {
feedback: feedback
};
}
// create an instance
var kbArticleRating = new KbArticleRatingClass();
</script>
<j2:if test="$[show_kb_yn_rating]">
<div class="kb_box_centered" aria-role="question"
aria-label="${gs.getMessage('Is this article helpful?')}"
tabindex="0">
<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"
aria-label="${gs.getMessage('Yes')}"
onclick="kbArticleRating.feedback('yes')">${gs.getMessage('Yes')}</button>
<button class="btn btn-destructive-subdued kb-article-no-btn"
aria-label="${gs.getMessage('No')}"
onclick="kbArticleRating.feedback('no')">${gs.getMessage('No')}</button>
<span class="kb-article-yn-percentage">${kbViewInfo.helpfulText}</span>
</span>
</div>
</j2:if>
</j2:if>
</j2:if>
</j2:if>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2021 01:04 AM
Hi, i want to add button and field in alert box or pop ,so what will be script .