How to check strings in a text file attached during a catalog order.

Ryota
Tera Guru

When ordering a catalog item, I need to attach a text file. Is there a way to prevent the attachment if the file contains specific strings (such as 'delete' or 'change')? I would like to apply this rule to a specific catalog item only.

1 REPLY 1

Ankur Bawiskar
Tera Patron

@Ryota 

it's difficult to achieve this with OOTB paper-clip icon and onSubmit script

Approach

1) create attachment type variable and only allow txt file using variable attributes

allowed_extensions=txt

2) then write onChange catalog client script on that variables and use GlideAjax, send the sysId of the variable value, then query sys_attachment and read the text file

see if this link helps and enhance your script, I shared solution on how to validate file when file is attached to attachment variable

Validate Excel Data and populate in MRVS 

Validations on MRVS - validate Employee ID 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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