<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: After BR causing duplication of activity in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181439#M838365</link>
    <description>&lt;P&gt;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()&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A href="http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0" title="http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0"&gt;http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 05 Jan 2017 16:32:57 GMT</pubDate>
    <dc:creator>davidpanson</dc:creator>
    <dc:date>2017-01-05T16:32:57Z</dc:date>
    <item>
      <title>After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181436#M838362</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/75946i6FAC02E27ED6760C/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/75943i26EA863C10A9F6F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/75940i4729CBE2F1A55429/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/75942i524F308501E4801A/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it as a Before BR, but it didn't work because the closed_at isn't populated yet. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be helpful. Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mickey Cegon&lt;/P&gt;&lt;P&gt;Farm Bureau Financial Services, Inc.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:10:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181436#M838362</guid>
      <dc:creator>Mickey_Cegon</dc:creator>
      <dc:date>2017-01-05T16:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181437#M838363</link>
      <description>&lt;P&gt;If you run this as an AFTER BR, it is going to trigger all the BRs again with the current.update().&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;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.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: 'Helvetica Neue';"&gt;Reference:&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: 'Helvetica Neue'; color: #2989c5;"&gt;&lt;A title="ki.servicenow.com/index.php?title=Business_Rules" href="http://wiki.servicenow.com/index.php?title=Business_Rules"&gt;Business Rules - ServiceNow Wiki&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: 'Helvetica Neue'; color: #2989c5;"&gt;&lt;A title="ki.servicenow.com/index.php?title=Business_Rules_Best_Practices" href="http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices"&gt;Business Rules Best Practices - ServiceNow Wiki&lt;/A&gt;&lt;SPAN style="color: #3d3d3d;"&gt; &amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:19:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181437#M838363</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2017-01-05T16:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181438#M838364</link>
      <description>&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;Hi Cegon,&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;Avoid using &lt;TT&gt;current.update()&lt;/TT&gt; in a business rule script. The &lt;TT&gt;update()&lt;/TT&gt; method triggers business rules to run on the same table for insert and update operations, leading to a business rule calling itself over and over. Changes made in &lt;EM&gt;before&lt;/EM&gt; business rules are automatically saved when all &lt;EM&gt;before&lt;/EM&gt; business rules are complete, and &lt;EM&gt;after&lt;/EM&gt; business rules are best used for updating related, not current, objects. When a recursive business rule is detected, the system stops it and logs the error in the system log. However, &lt;TT&gt;current.update()&lt;/TT&gt; causes system performance issues and is never necessary.&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;You can prevent recursive business rules by using the &lt;TT&gt;&lt;A href="http://wiki.servicenow.com/index.php?title=GlideRecord#setWorkflow" style="color: #031da7;" title="GlideRecord"&gt;setWorkflow()&lt;/A&gt;&lt;/TT&gt; method with the false parameter. The combination of the &lt;TT&gt;update()&lt;/TT&gt; and &lt;TT&gt;setWorkflow()&lt;/TT&gt;methods is only recommended in special circumstances where the normal before and after guidelines mentioned above do not meet your requirements.&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P style="margin-top: 0.4em; margin-bottom: 0.5em; color: #333333; font-family: Omnes-pro, Arial, Verdana, sans-serif;"&gt;Sagar&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:24:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181438#M838364</guid>
      <dc:creator>Sagar V1</dc:creator>
      <dc:date>2017-01-05T16:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181439#M838365</link>
      <description>&lt;P&gt;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()&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A href="http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0" title="http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0"&gt;http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices#gsc.tab=0&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:32:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181439#M838365</guid>
      <dc:creator>davidpanson</dc:creator>
      <dc:date>2017-01-05T16:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181440#M838366</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __jive_macro_name="quote" class="jive_macro_quote jive_text_macro" data-renderedposition="59.815338134765625_7.997159004211426_996_41"&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;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.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:43:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181440#M838366</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2017-01-05T16:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181441#M838367</link>
      <description>&lt;P&gt;Thanks for the quick response, Chuck. I took a look at the order of all the BR running, and it ends up that the Set Closure Fields BR was set to an order of 10,000. So, I changed my BR to a Before, changed the Order to 20,000, and removed the current.update() from the rule. It now only updates the one time, so I think I've got it fixed. Once I set it to wait until the closure fields were actually set, then the calculation worked.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Mickey Cegon&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:56:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181441#M838367</guid>
      <dc:creator>Mickey_Cegon</dc:creator>
      <dc:date>2017-01-05T16:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181442#M838368</link>
      <description>&lt;P&gt;Ding ding ding! Thanks for the update Mickey. Nobody ever pays attention to the order field until things get weird. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" data-renderedposition="7.997159004211426_720.5965576171875_15_16" src="https://www.servicenow.com/8.0.4.21bdc7e/images/emoticons/happy.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: Arial; color: #666666;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: Arial; color: #666666;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 12px; font-family: Times; color: #000000;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: Arial; color: #666666;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;If you are viewing this from the community inbox you will not see the correct answer button. &amp;nbsp; If so, please review &lt;A _jive_internal="true" href="https://www.servicenow.com/community?id=community_article&amp;amp;sys_id=7f1c2e21dbd0dbc01dcaf3231f9619c3"&gt;&lt;SPAN style="color: #0000ee; text-decoration: underline;"&gt;How to Mark Answers Correct From Inbox View&lt;/SPAN&gt;&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 12px; font-family: Times; color: #000000;"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: Arial; color: #666666;"&gt;Thank you&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 17:08:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181442#M838368</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2017-01-05T17:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: After BR causing duplication of activity</title>
      <link>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181443#M838369</link>
      <description>&lt;P&gt;You are correct. I must have a duration calculation I can't find somewhere else. My mistake.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jan 2017 17:25:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/after-br-causing-duplication-of-activity/m-p/2181443#M838369</guid>
      <dc:creator>davidpanson</dc:creator>
      <dc:date>2017-01-05T17:25:43Z</dc:date>
    </item>
  </channel>
</rss>

