run business rule after attaching file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:43 PM
I need to run a business rule after attaching a file to a record .. I can do this by clicking on the save button (or update) however I would prefer to update the record as soon as the file is attached without needing to press the save or update button
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 02:48 PM
so is your requirement to run a br when an attachment has been attached or to save the record when an attachment is made?
if you need to run a BR just trigger off of the sys_attachment table when table name = 'whatever table you want'
if you want to save the record I think this depends if you are doing this in service portal or not...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 05:30 PM
Along with what Nathan has mentioned, you might want to check the value of 'table_sys_id' in the sys_attachement to the current record sys_id in the Business Rule to make sure the Business Rule runs only when a record in inserted for the current record to which you are adding the attachment.
1. Create a Business Rule on sys_attachment table which will run for every insert for your table name and for any content_type you want.
2. In the Business rule, take the 'current.table_sys_id' from the sys_attachment table and query your table to update any field you want or use gs.addInfoMessage()..etc
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 03:41 PM
Hi Irvin,
What is the underlying requirement here? What do you want to do with this BR when you attach a file to that record? It sounds like you've got a technical solution picked out without us understanding the requirement which could provide additional options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 03:02 AM
Hi Chuck
When a attachment is added to a record in Servicenow, i have written a BR to execute a REST message to send the attachment to 3rd party tool.
Unless there is any save/update on current record, my BR wont trigger.
What can be best approach to achieve that?