
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 08:10 AM
I created an After BR to calculate the calendar_duration on the rm_story table. I need to calculate the diff between the opened_at and closed_at fields, so I set it to run After Active changesTo False. Works great, but it shows up in the activity log once, with a second set of activity showing and a duplicate entry in the Audit History list.
I tried it as a Before BR, but it didn't work because the closed_at isn't populated yet.
Any suggestions would be helpful. Thanks in advance!
Mickey Cegon
Farm Bureau Financial Services, Inc.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 08:19 AM
If you run this as an AFTER BR, it is going to trigger all the BRs again with the current.update().
If closed_at is not populated like you say, try doing a current.setWorkflow(false) right before and give your BR a very high order (10,000) so it runs last to avoid stopping other BRs that might run after it.
Reference:
Business Rules - ServiceNow Wiki
Business Rules Best Practices - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 08:32 AM
Just beating a dead horse now but to be explicit relating to your issue you can just remove current.update() to solve your problem. I tried it without and it functions fine the way you have it set up. (from my quick testing anyway) The current.update() will cause it to update again and create the duplicate in your log. In the best practices which has been quoted and referenced it says never to use current.update()
http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 08:43 AM
Hi David,
you can just remove current.update() to solve your problem. I tried it without and it functions fine the way you have it set up.
I'd love to see your test results and understand which BRs are triggering and in what order. Adding updates to current fields in an after or async rule without any update does not update those field values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2017 09:25 AM
You are correct. I must have a duration calculation I can't find somewhere else. My mistake.