Follow the below steps:-
1.Create UI Script
3. Catalog Client Script:
function onSubmit() {
//Works in non-portal UI
try {
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach the completed form before submitting this request.');
return false;
}
}
//For Service Portal
catch(e) {
var count = getSCAttachmentCount();
if(count <= 0) {
alert('You must attach the completed form before submitting this request.');
return false;
}
}
}
1.Create UI Script
UI Script: GlobalCatalogItemFunctions
Global: true
Script:
function getSCAttachmentCount() {
   var length;
   try {
   length = angular.element("#sc_cat_item").scope().attachments.length;
   } catch(e) {
   length = -1;
   }
   return length;
}
2. Select your Portal > Theme(Open the theme and go to the related list section, click JS include tab and click the new UI action). 
Create New:- JS Theme
Display Name:- GlobalCatalogItemFunctions
Source:- UI Script
UI Script: GlobalCatalogItemFunctions(Select the UI script that is you created)
function onSubmit() {
//Works in non-portal UI
try {
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach the completed form before submitting this request.');
return false;
}
}
//For Service Portal
catch(e) {
var count = getSCAttachmentCount();
if(count <= 0) {
alert('You must attach the completed form before submitting this request.');
return false;
}
}
}