- 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
‎08-03-2022 09:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2022 07:18 AM
Oh! That did it. The only change i need to make is for this to only apply when the 'Other' reason is selected.
I did try
if (!c.data.reason == 4)
But that didn't work. I think that's the right code but maybe I'm putting it in the wrong place?
Edit: The below worked
if (c.data.reason == 4 && c.data.details == ''){
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 02:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 03:29 PM
To clarify, I'm getting the above error after cloning the Knowledge Article Content widget, then updating the client script code, then adding the new widget to the "kb_article_view" page and removing the OOB Knowledge Article Content. Did you not get this error?
thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 03:32 PM