How can i restrict particular type of document in attachment?

The Matrix
Tera Contributor

Hii, 

i have a scenario where only PDF files should only get attach to the incident form. How can i achieve this. 

1 ACCEPTED SOLUTION

@Siddharam Takali 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

 

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use before insert BR on sys_attachment table

Condition: current.table_name == 'incident'

Script:

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

	// Add your code here
	var fileType = current.content_type;
	if(fileType.toString() != 'application/pdf'){
		current.setAbortAction(true);
	}

})(current, previous);

Regards
Ankur

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

@Siddharam Takali 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

@Siddharam Takali 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

 

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

Could U pls mention few file types that wont cause any harm to our instances  and also file types which effects