Pop up mandatory attachment message

Srinivasu2
Tera Contributor

Hi Community,

 

Pop up a mandatory attachment message on service portal based on condition, like select a Data master is customer and Operation is New.

 

Attachments code is not working for me, Please let me where i did a mistake?

 

Please find the below attachments  code

 

 

Regards,

Srinivasu Sagiraju

5 REPLIES 5

dhaz
Tera Guru

May I ask why you are not using a UI Policy for this? Give the UI policy a condition, IF these field values are present, then make the attachment icon mandatory.

Srinivasu2
Tera Contributor

Hi dhaz,

 

Could you please provide a UI Policy script for this requirement, 

 

Condition Data master is Customer and Operation is New than attachment icon mandatory

 

Please find the below screenshot for your reference

 

Regards,

Srinivasu Sagiraju

 

Siva Jyothi M
Mega Sage

Hi @Srinivasu2,

 

Can you try the below code.

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

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

 

Regards,

Siva Jyothi M.

Hi Siva Jyothi,

 

I need to satisfy  both the condition like Data master is Customer and Operation is New 

 

Please find the below screenshot for the requirement and It will pop up mandatory attachment  message in service portal for this catalogue item

 

Regards,

Srinivasu