Removing attachment does not trigger change business rule

thisisauniqueus
Giga Expert

Hi,

I have created a form with lets say 2 check boxes and defined a business rule that run on insert and update. The business rule constrains the user to upload files for the number of check boxes checked. so far so good but when the user update the record and remove an attachment, does not make any change to the form values; the update business rule does not run.. changing the form values triggers the update BR just fine.

Pl guide me what i am doing wrong here...

Regards

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

The reason for this is because managing attachments is operating on the sys_attachment table, not the incident table (or whatever your business rule is watching.) If you want to make an update to that record, place a business rule on sys_attachment and use the table_name and table_sys_id fields to determine the target record information.



My preference would be to use an AFTER business rule that includes the Delete field set to true.


Business Rules - ServiceNow Wiki


Business Rules Best Practices - ServiceNow Wiki  


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

The reason for this is because managing attachments is operating on the sys_attachment table, not the incident table (or whatever your business rule is watching.) If you want to make an update to that record, place a business rule on sys_attachment and use the table_name and table_sys_id fields to determine the target record information.



My preference would be to use an AFTER business rule that includes the Delete field set to true.


Business Rules - ServiceNow Wiki


Business Rules Best Practices - ServiceNow Wiki  


this After BR i will have to place on sys_attachment table right?



Regards,


Yes, you are watching for changes on the sys_attachment table. Even though the user is looking at an incident record, they are not changing anything on the incident. Think of it as a pretty "related list". The records are related, but not necessarily making any changes to the record you are viewing.



Hope that's clear.


just a quick question, i have placed the BR as suggested by you, can you please tell how can i show an error message because when i do



gs.addInfoMessage('hello');



it does not show up on the form



Regards