Hi,

this should work in native; will have to check for portal

Ensure Isolate Script Field is set To False for this client script for DOM to work

function onSubmit() {
	//Type appropriate comment here, and begin script below
	var arr = [];

	if(window != null){
		$j("a.content_editable").each(function( index ) {
			var val = $j(this).text();
			arr.push(val.toString());
		});
		alert('File Names are'+ arr);
		return false;
	}

}

Output: it gave me 2 files names then you can iterate over each and check the file name starts with keyword or not

once you get all the file names you can iterate and check if it is allowed or not

Please mark my response as correct and close the thread

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader