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

Hi @Srinivasu2,

 

You can add a AND condition like below.

function onSubmit() {
  var test = g_form.getDisplayValue('data_master'); // Try with getValue if this doesn't work
var test1 =  g_form.getDisplayValue('operation'); // Try with getValue if this doesn't work
  
  if((this.document.getElementsByClassName('get-attachment').length == 0) && (test == 'Customer' ) &&( test1 == 'New' )) {
           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.