how to set Attachment Mandatory in Service portal cataloque item

Srinivasu2
Tera Contributor

Hi Community,

 

How to set Service portal catalogue item Attachment symbol mandatory

 

If i select data master  is Customer and operation is New,  Attachment symbol should be mandatory in Service portal catalogue item

 

Please suggest how to do that?

 

Regards,

Srinivasu 

7 REPLIES 7

Siva Jyothi M
Mega Sage

Hi @Srinivasu2,

 

If the requirement is making Attachment field mandatory, you can check the mandatory attachment under the portal settings section.

Or if the requirement is to make the attachment field mandatory based on a form field selection, please find the sample script below.

function onSubmit() {
  var test = g_form.getValue('customer_operation');
	
	if((this.document.getElementsByClassName('get-attachment').length == 0) && (test == 'New' )) {
           alert('You must add an attachment before submitting this request.');
           return false;
           }
	else{
		return true;
	}
}
       

Mark this answer as correct and helpful if it solves your issue.

 

Regards,

Siva Jyothi M.

 

Dr Atul G- LNG
Tera Patron
Tera Patron

HI @Srinivasu2 

 

If I am not wrong it is OOTB.

 

AtulyaG_0-1694604276693.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Chaitali_Vale
Mega Sage
Mega Sage

Hello @Srinivasu2 ,

You can create UI policy to fulfil the requirement. 
1. Need to create one variable which type is attachment.

Chaitali_Vale_0-1694607495598.png

 

2. Then create one UI policy & add conditions as "Data master is Customer & Operation is New", if this condition is satisfied then make the attachments field mandatory. 

 

Chaitali_Vale_2-1694607660654.png

 

Chaitali_Vale_4-1694607698041.png

Please mark my solution as Helpful/Correct, if applicable. 

Thanks & Regards,
Chaitali Vale