- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 08:45 AM
I extended the User (sys_user) table and added some attachment related columns (to allow for download/deletion via the portal). I created a Business Rule to clear these fields when an attachment is deleted. This works fine when only one attachment is deleted. However if you delete multiple via "Manage Attachments", the business rule runs only once and only one of the attachments related columns are cleared.
Any ideas on what I need to do to catch each deletion?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2017 12:40 PM
Hi Bryan,
Please use few code in your addQuery below.
gr.addQuery('table_sys_id', current.table_sys_id);
You are using if condition to check if sys_id matches and then update the record, that means you will be taking care only one record since var file_sys_id = current.sys_id.toString() will give you sys_id of current record. So, i think if you want to delete all the record based upon the table_sys_id then while loop should work without if/else condition in that.
In your else if condition you are using gr.gr.<variable name>. two times gr is not correct.
In file_sys_id == gr.resume_sys_id, is resume_sys_id a reference field which gives sys_id?
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2017 01:18 PM
Duh...user error on my part. After reviewing your answer a second time, I noticed this statement:
"In your else if condition you are using gr.gr.<variable name>. two times gr is not correct."
I don't know how many times I've looked at that script and never noticed the duplicate gr's.
I removed the extra gr and everything works now. Thanks and sorry to everyone for wasting your time...