How to make attachment mandatory in a record producer creating an incident?

muktha1
Tera Guru

I have a record producer form creating an incident . It is accessed from the service portal. Attachment has to be made mandatory before submission of the form. Can anyone please suggest the best way to achieve it in Service portal? Thanks in advance

11 REPLIES 11

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could add an onSubmit Catalog Client Script like below:

function onSubmit() {
  
	if(this.document.getElementsByClassName('get-attachment').length == 0) {
		g_form.addErrorMessage(getMessage('Attachment is mandatory!'));

		return false;
	}	
   
}

Be sure to double check the UI Type in the Catalog Client Script!

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

The above client script is working fine in London version

Thanks very much. This worked for me.

not working in Xanadu release