- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 12:52 PM
I have a requirement to make the 'details' comment box on the KB Feedback pop up, mandatory if the reason of 'Other' is selected. See last image.
I have tried other community suggestions such as creating a UI Policy on the kb_feedback table setting the 'comments' field to Mandatory=True if the Reason is 'other', see middle image. And editing code on the Knowledge Article Content widget, but those methods did not work.
Specifically this is the code i edited but the 'details' field still does not become mandatory, nor does the flag message display.
Has anyone been able to get this to work and could perhaps see what i'm missing?
c.submitFeedbackTask = function() {
if (!c.data.reason == 4) {
c.flagMessage = "${Please provide the mandatory details}";
$("#detailsComment").focus();
return false;
} else {
c.submitted = true;
c.closePopup();
}
}
or
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 08:16 PM
Hi I have already shared the same requirement here you can check
https://community.servicenow.com/community?id=community_question&sys_id=2a771997db3491100d48db85ca96199a
Solution:
Hi you need to clone Knowledge Article Content widget and in client controller you can make this as mandatory. Look for the below function
c.submitFeedbackTask = function(){
if(!c.data.reason){
c.flagMessage = "${Please provide the mandatory details}";
$("#detailsComment").focus();
return false;
}
// add the below bold statement
if(!c.data.details){
c.flagMessage = "${Please provide the mandatory details}";
$("#detailsComment").focus();
return false;
}
else{
c.submitted = true;
c.closePopup();
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 10:46 AM
That code was all I added. I had previously cloned the widget some time ago for a different requirement. Your error looks like your service portal page is maybe still pointing at the original widget and not the cloned one you created.
Let me know if that's the case, or, that's where i would start investigating.
Thanks
Russ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 10:54 AM
c.submitFeedbackTask = function(){
if (c.data.reason == 4 && c.data.details == ''){
c.flagMessage = "${Please provide the mandatory details}";
$("#detailsComment").focus();
return false;
}
else{
c.submitted = true;
c.closePopup();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2022 12:36 PM
Hi Russell,
thanks for the feedback.
One more question...does your solution prevent the user from closing the popup by selecting the "X" or clicking away on the screen? (which then also submits the feedback)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2022 03:43 PM
I just checked. There is no 'x' on the popup. By clicking away on the screen it still generates an entry in the Knowledge - Feedback module but it does not generate a Feedback Task in the Knowledge - All Open Tasks.
Ill bring this to the Knowledge team because I don't think they're aware of the Feedback Module, if they are, there aren't any actions on those entries.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2024 12:54 AM
Having same requirement but I am getting same error as previously mention, please let me know how to overcome through this..