
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
In my last post, I talked about using the server script on the Record Producer to evaluate an attached Excel File. Now I'll attempt to add a scanner when the file is attached to the attachment field on the form. This process uses the code from the basic example in the documentation on GlideExcelParser here.
To start, I set up a script include to take in the sys_id of the attachment, break it apart using GlideSysAttachment and GlideExcelParser, and then roll through each row looking at column 1 in the Excel file. It just does a name query against the HR Service table and returns a list of invalid row numbers if it finds any.
Next, I added a Catalog Client Script on my Record Producer to call the Script Include onChange of the File variable. I'm passing in newValue which is just the sys_id of the attachment that would be added to the form,
Then I mocked up a test input file with some invalid HR Service names. The script will check for them in column B, or [1] in the parser script.
Attaching that file to my form triggered the call to the Script Include to do the validation. I received a list of numbers back from the script so I displayed that in the error box.
Running my original valid file passed my scan successfully.
There's a lot more that could be done with file checks, but this hopefully provides some basic idea of how you can monitor the attachments added to the system when a specific template is needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.