Make 'details' on SP Knowledge Feedback mandatory

Russell Abbott
Kilo Sage

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

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

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();
        }
    }

Regards
Harish

View solution in original post

16 REPLIES 16

  • Go to the page kb_article_view
  • Down in the 'page content'section, you see the instances and go to the instance with 'Knowledge Article Content'
  • In the instance go to the tab Widget and there you have to change the OOTB widget with the name of the widget you cloned(XXX Knowledge Article Content)

Make sure for your cloned widget you copy down the Angular ng templates
LeviB_0-1730146056389.png