Limit amount of characters in record attachments filename

Cameron Hecksta
Tera Contributor

Is it possible to set a limit on the total combined filename character length of all added attachments? We want to prevent specific records saving attachments that will have more than a combines limit of 506 characters.

 

No limit on how many attachments but if attachments reach more than 506 characters then no more.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Cameron Hecksta 

only way I could think of is Before insert BR on sys_attachment and check the count of characters

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var fileName = current.file_name.toString();
	
	if(fileName.length > 10)
		current.setAbortAction(true);

})(current, previous);
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Cameron Hecksta 

only way I could think of is Before insert BR on sys_attachment and check the count of characters

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var fileName = current.file_name.toString();
	
	if(fileName.length > 10)
		current.setAbortAction(true);

})(current, previous);
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader