Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make knowledge article attachment mandatory on incident form based on resolution code choice.

snow_beginner
Giga Guru

Hi,

So there is a requirement that if the 'Resolution Code' = Known Error on the incident form then an attachment needs to be mandatory of a Knowledge article. How would I achieve that functionality? To make the (📎) thats on top of the form mandatory, what would be needed?

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @snow_beginner 

 

Make a Business Rule as below on the incident table :

 

AmitVerma_0-1706870973727.png

 

AmitVerma_1-1706870993164.png

 

(function executeRule(current, previous /*null when async*/ ) {

    if (current.hasAttachments() != true) {

        gs.addInfoMessage("Please add a relevant knowledge article to proceed!!!");

		current.setAbortAction(true);

    }

})(current, previous);

 

Output :

 

AmitVerma_2-1706871169868.png

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

@Akansha Gupta 

 

Preferred way would be Business Rule as client script requires DOM Manipulation.


Please mark this response as correct and helpful if it assisted you with your question.

@Amit Verma - thanks a lot for your help!