<?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 Worknotes being added twice is user is has multiple roles in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380743#M4693</link>
    <description>&lt;P&gt;I have a Business Rule which updates a worknote when a field value is changed and there is a simple script which checks who has updated the field and applies the appropriate worknote.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I have is that there is overlap. A user can have the architure domain admin/manager role AND also be a business steward or tech owner, in which case the worknote is updating twice. How can I tidy this up to avoid this happening? Please suggested simple low code solution, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; executeRule(current, previous &lt;/SPAN&gt;&lt;SPAN&gt;/*null when async*/&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationSteward = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_cmdb_data_steward'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationStewardName = current.u_cmdb_data_steward.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwner = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_custodian'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwnerName = current.u_custodian.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//If the field changes business app steward&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;FONT color="#99CC00"&gt; &amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#99CC00"&gt;&lt;SPAN&gt;//If the field changes&amp;nbsp; by the Technical Owner&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the field changes and is updated by users with the architecture_domain_admin OR architecture_domain_manager role&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (current.u_primary_capability.changes() &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; (gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'lbg_architecture_domain_admin'&lt;/SPAN&gt;&lt;SPAN&gt;) || gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'lbg_architecture_domain_manager'&lt;/SPAN&gt;&lt;SPAN&gt;))) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; userName = gs.getUserDisplayName();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;"The Primary Capability field has been updated by "&lt;/SPAN&gt;&lt;SPAN&gt; + userName + &lt;/SPAN&gt;&lt;SPAN&gt;"."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;})(current, previous);&lt;/P&gt;</description>
    <pubDate>Mon, 15 Sep 2025 13:57:06 GMT</pubDate>
    <dc:creator>Kiran_25</dc:creator>
    <dc:date>2025-09-15T13:57:06Z</dc:date>
    <item>
      <title>Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380743#M4693</link>
      <description>&lt;P&gt;I have a Business Rule which updates a worknote when a field value is changed and there is a simple script which checks who has updated the field and applies the appropriate worknote.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I have is that there is overlap. A user can have the architure domain admin/manager role AND also be a business steward or tech owner, in which case the worknote is updating twice. How can I tidy this up to avoid this happening? Please suggested simple low code solution, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; executeRule(current, previous &lt;/SPAN&gt;&lt;SPAN&gt;/*null when async*/&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationSteward = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_cmdb_data_steward'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationStewardName = current.u_cmdb_data_steward.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwner = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_custodian'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwnerName = current.u_custodian.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//If the field changes business app steward&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;FONT color="#99CC00"&gt; &amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#99CC00"&gt;&lt;SPAN&gt;//If the field changes&amp;nbsp; by the Technical Owner&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the field changes and is updated by users with the architecture_domain_admin OR architecture_domain_manager role&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (current.u_primary_capability.changes() &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; (gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'lbg_architecture_domain_admin'&lt;/SPAN&gt;&lt;SPAN&gt;) || gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'lbg_architecture_domain_manager'&lt;/SPAN&gt;&lt;SPAN&gt;))) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; userName = gs.getUserDisplayName();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;"The Primary Capability field has been updated by "&lt;/SPAN&gt;&lt;SPAN&gt; + userName + &lt;/SPAN&gt;&lt;SPAN&gt;"."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;})(current, previous);&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 13:57:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380743#M4693</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2025-09-15T13:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380750#M4694</link>
      <description>&lt;P&gt;You can make the second and third if statements else if statements.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:01:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380750#M4694</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2025-09-15T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380754#M4695</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try these changes&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The check for &lt;STRONG&gt;u_primary_capability&lt;/STRONG&gt; change happens once.&lt;/LI&gt;
&lt;LI&gt;The user identity condition checks are done in order with else if so only the first applicable note is set.&lt;/LI&gt;
&lt;LI&gt;This prevents multiple overwrites and duplicate work notes when users have multiple roles.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="javascript"&gt;(function executeRule(current, previous /*null when async*/) {
    var businessApplicationSteward = current.getValue('u_cmdb_data_steward');
    var businessApplicationStewardName = current.u_cmdb_data_steward.name + "";
    var technicalApplicationOwner = current.getValue('u_custodian');
    var technicalApplicationOwnerName = current.u_custodian.name + "";

    if (current.u_primary_capability.changes()) {
        var currentUserID = gs.getUserID();

        if (currentUserID == businessApplicationSteward) {
            current.work_notes = 'The Primary Capability field has been updated by the Technical owner representative ' + businessApplicationStewardName;
        } else if (currentUserID == technicalApplicationOwner) {
            current.work_notes = 'The Primary Capability field has been updated by the Technical Owner ' + technicalApplicationOwnerName;
        } else if (gs.hasRole('lbg_architecture_domain_admin') || gs.hasRole('lbg_architecture_domain_manager')) {
            var userName = gs.getUserDisplayName();
            current.work_notes = "The Primary Capability field has been updated by " + userName + ".";
        }
    }
})(current, previous);
&lt;/LI-CODE&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:02:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380754#M4695</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-09-15T14:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380756#M4696</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The duplicate worknotes are coming from the fact that your script allows more than one condition to evaluate as true at the same time. Since a single user can have multiple roles, more than one block runs and the work_notes field gets set twice.&lt;/P&gt;&lt;P&gt;A simple way to fix this is to control the flow so only one branch executes. You can do that by using else if instead of separate if statements, or by adding an additional check before writing to work_notes (for example, only update if it’s still empty in that transaction). This way even if the user has overlapping roles, the system will only log one clear worknote.&lt;/P&gt;&lt;P&gt;Keeping it structured like that will keep the logic simple and avoid the duplicates without needing heavy customization.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;BR /&gt;&lt;STRONG&gt;Thanks &amp;amp; Regards,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Muhammad Iftikhar&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;If my response helped, please mark it as the accepted solution so others can benefit as well.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:04:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380756#M4696</guid>
      <dc:creator>miftikhar20</dc:creator>
      <dc:date>2025-09-15T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380757#M4697</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why do you need to create 3 IF loops to make it work, replace it with IF and ELSE IF condition and it should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helped to answer your query, please mark it helpful &amp;amp; accept the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bhuvan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:04:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380757#M4697</guid>
      <dc:creator>Bhuvan</dc:creator>
      <dc:date>2025-09-15T14:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380766#M4698</link>
      <description>&lt;P&gt;the actual script is much larger and also updates workntoes for other types of fields too, all following the same format as the snipped I have shared.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would I have to update ALL of the IF statements in the script or just the ones that relate to the problematic field?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:07:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380766#M4698</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2025-09-15T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380773#M4699</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;I have shared the part of the script that is relevant the issue I'm facing but the actual script is much larger and updates worknotes for when other fields are changed tooand it has all been done as IF statements.&lt;/P&gt;&lt;P&gt;So would&amp;nbsp;ALL of the IF statements in the script or just the ones that relate to the primary capability field?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:10:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380773#M4699</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2025-09-15T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380783#M4700</link>
      <description>&lt;P&gt;Hi, there are multiple way how it could be done;&amp;nbsp;&lt;BR /&gt;simplest just to add some flag to track if work-notes were added notesAdded then set it if added and add to conditions;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(function executeRule(current, previous /*null when async*/) {

    var businessApplicationSteward = current.getValue('u_cmdb_data_steward');
    var businessApplicationStewardName = current.u_cmdb_data_steward.name+"";
    var technicalApplicationOwner = current.getValue('u_custodian');
    var technicalApplicationOwnerName = current.u_custodian.name+"";
    var notesAdded = false;
   

//If the field changes business app steward
    if (((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward))&amp;amp;&amp;amp; !(notesAdded) ){
            current.work_notes = 'The Primary Capability field has been updated by the Technical owner representative '+ businessApplicationStewardName;
            notesAdded = true;

    }

    //If the field changes  by the Technical Owner
    if (((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) &amp;amp;&amp;amp; !(notesAdded) ) {

            current.work_notes = 'The Primary Capability field has been updated by the Technical Owner '+ technicalApplicationOwnerName;
             notesAdded = true;
    }

    //If the field changes and is updated by users with the architecture_domain_admin OR architecture_domain_manager role

    if ((current.u_primary_capability.changes() &amp;amp;&amp;amp;
    (gs.hasRole('lbg_architecture_domain_admin') || gs.hasRole('lbg_architecture_domain_manager'))) &amp;amp;&amp;amp; !(notesAdded) ){
    var userName = gs.getUserDisplayName();
    current.work_notes = "The Primary Capability field has been updated by " + userName + ".";
     notesAdded = true;

}

 

})(current, previous);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Overall this script could be optimised even more:&amp;nbsp;&lt;BR /&gt;1. i would move "&lt;SPAN&gt;u_primary_capability" - "changes" into business rule condition itself, so if not changed BR is not triggered at all&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. to use return&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ar userSysId = gs.getUserID();
  var userName  = gs.getUserDisplayName();

  // Pull IDs safely (these are reference fields; getValue returns sys_id)
  var stewardId = current.getValue('u_cmdb_data_steward');
  var ownerId   = current.getValue('u_custodian');

  // Optional: pull display values defensively (in case refs are empty)
  var stewardName = current.getDisplayValue('u_cmdb_data_steward');
  var ownerName   = current.getDisplayValue('u_custodian') ;

  // Priority 1: architecture roles
  if (gs.hasRole('lbg_architecture_domain_admin') || gs.hasRole('lbg_architecture_domain_manager')) {
    current.work_notes = 'The Primary Capability field has been updated by ' + userName + '.';
    return; // prevent other branches from running
  }

  // Priority 2: technical owner
  if (userSysId === ownerId) {
    current.work_notes = 'The Primary Capability field has been updated by the Technical Owner ' + ownerName + '.';
    return;
  }

  // Priority 3: business application steward
  if (userSysId === stewardId) {
    current.work_notes = 'The Primary Capability field has been updated by the Business Application Steward ' + stewardName + '.';
    return;
  }&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I haven't run the code, but you can get the idea.&lt;BR /&gt;Please mark solved/helpful if solved/helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:16:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380783#M4700</guid>
      <dc:creator>Nos1ze</dc:creator>
      <dc:date>2025-09-15T14:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380784#M4701</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can share the script and if you need, I can optimize and share it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF condition will run every time the condition is met, hence you are seeing multiple work notes being added if a user with multiple roles [Application Owner or Application Steward or has one of roles lbg_architecture_domain_admin, lbg_architecture_domain_manager] and field value changes. You can optimize it to IF and ELSE IF condition so that it will have only one work notes added. If needed you can use AND &amp;amp;&amp;amp; OR || conditions in the IF and ELSE IF loop to create unique combinations based on your requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helped to answer your query, please mark it helpful &amp;amp; accept the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bhuvan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:17:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380784#M4701</guid>
      <dc:creator>Bhuvan</dc:creator>
      <dc:date>2025-09-15T14:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380795#M4702</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do you have any other business rule running with current.update?&lt;/P&gt;
&lt;P&gt;yes please use IF ELSE logic.&lt;/P&gt;
&lt;P&gt;share the complete script.&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:22:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3380795#M4702</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-09-15T14:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381618#M4727</link>
      <description>&lt;P&gt;Sure, heres the complete script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; executeRule(current, previous &lt;/SPAN&gt;&lt;SPAN&gt;/*null when async*/&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationSteward = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_cmdb_data_steward'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; businessApplicationStewardName = current.u_cmdb_data_steward.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwner = current.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'u_custodian'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; technicalApplicationOwnerName = current.u_custodian.name+&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Business Application Type field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_business_application_type.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Business Application Type field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Business Application Type field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_business_application_type.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Business Application Type field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Description field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.short_description.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Description field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Description field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.short_description.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Description field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the End Date field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_end_date.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The End Date field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the End Date field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_end_date.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The End Date field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the New Application Reason field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_new_application_reason.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The New Application Reason field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the New Application Reason field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_new_application_reason.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The New Application Reason field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Primary Capability field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Primary Capability field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_primary_capability.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Primary Capability field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Primary Capability changes and is updated by users with the architecture_domain_admin OR architecture_domain_manager role&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;else if&lt;/SPAN&gt;&lt;SPAN&gt; (current.u_primary_capability.changes() &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; (gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'architecture_domain_admin'&lt;/SPAN&gt;&lt;SPAN&gt;) || gs.hasRole(&lt;/SPAN&gt;&lt;SPAN&gt;'architecture_domain_manager'&lt;/SPAN&gt;&lt;SPAN&gt;))) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; userName = gs.getUserDisplayName();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;"The Primary Capability field has been updated by "&lt;/SPAN&gt;&lt;SPAN&gt; + userName + &lt;/SPAN&gt;&lt;SPAN&gt;"."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Start Date field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.start_date.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Start Date field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Start Date field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.start_date.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Start Date field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Strategic Status field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_strategic_status.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Strategic Status field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Strategic Status field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_strategic_status.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Strategic Status field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Target Hosting Type field changes and was updated by the Technical owner representative&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_target_hosting_type_ref.changes() &amp;amp;&amp;amp; gs.getUserID() == businessApplicationSteward)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Target Hosting Type field has been updated by the Technical owner representative '&lt;/SPAN&gt;&lt;SPAN&gt;+ businessApplicationStewardName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;//If the Target Hosting Type field changes and was updated by the Technical Owner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ((current.u_target_hosting_type_ref.changes() &amp;amp;&amp;amp; gs.getUserID() == technicalApplicationOwner)) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; current.work_notes = &lt;/SPAN&gt;&lt;SPAN&gt;'The Target Hosting Type field has been updated by the Technical Owner '&lt;/SPAN&gt;&lt;SPAN&gt;+ technicalApplicationOwnerName;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;})(current, previous);&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 16 Sep 2025 07:33:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381618#M4727</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2025-09-16T07:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381620#M4728</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;I have shared the full script in another comment. Theres no other business rules, I've checked.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 07:35:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381620#M4728</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2025-09-16T07:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381635#M4730</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this optimized code&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;(function executeRule(current, previous /*null when async*/) {
    var businessApplicationSteward = current.getValue('u_cmdb_data_steward');
    var businessApplicationStewardName = current.u_cmdb_data_steward.name+"";
    var technicalApplicationOwner = current.getValue('u_custodian');
    var technicalApplicationOwnerName = current.u_custodian.name+"";
    var userID = gs.getUserID();

    function note(field, stewardText, ownerText) {
        if (current[field].changes()) {
            if (userID == businessApplicationSteward) {
                current.work_notes = stewardText + businessApplicationStewardName;
            } else if (userID == technicalApplicationOwner) {
                current.work_notes = ownerText + technicalApplicationOwnerName;
            } else if (gs.hasRole('architecture_domain_admin') || gs.hasRole('architecture_domain_manager')) {
                current.work_notes = "The " + field + " field has been updated by " + gs.getUserDisplayName() + ".";
            }
        }
    }

    note('u_business_application_type', 'The Business Application Type field has been updated by the Technical owner representative ', 'The Business Application Type field has been updated by the Technical Owner ');
    note('short_description', 'The Description field has been updated by the Technical owner representative ', 'The Description field has been updated by the Technical Owner ');
    note('u_end_date', 'The End Date field has been updated by the Technical owner representative ', 'The End Date field has been updated by the Technical Owner ');
    note('u_new_application_reason', 'The New Application Reason field has been updated by the Technical owner representative ', 'The New Application Reason field has been updated by the Technical Owner ');
    note('u_primary_capability', 'The Primary Capability field has been updated by the Technical owner representative ', 'The Primary Capability field has been updated by the Technical Owner ');
    note('start_date', 'The Start Date field has been updated by the Technical owner representative ', 'The Start Date field has been updated by the Technical Owner ');
    note('u_strategic_status', 'The Strategic Status field has been updated by the Technical owner representative ', 'The Strategic Status field has been updated by the Technical Owner ');
    note('u_target_hosting_type_ref', 'The Target Hosting Type field has been updated by the Technical owner representative ', 'The Target Hosting Type field has been updated by the Technical Owner ');

})(current, previous);&lt;/LI-CODE&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 07:49:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381635#M4730</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-09-16T07:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381694#M4733</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp; already shared the optimized version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please test and share your feedback as IF and ELSE IF should make sure work notes are added only once. Please note, in the IF and ELSE IF loop, if multiple conditions evaluate to true, only the first condition is evaluated. If you want work notes to uniquely identify who made the update, group loop conditions as per your requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to guide you or answer your query, please mark it helpful &amp;amp; accept the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bhuvan&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 08:17:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3381694#M4733</guid>
      <dc:creator>Bhuvan</dc:creator>
      <dc:date>2025-09-16T08:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Worknotes being added twice is user is has multiple roles</title>
      <link>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3492684#M6088</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/643280"&gt;@Kiran_25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing good.&lt;/P&gt;
&lt;P&gt;Did my reply answer your question?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Feb 2026 11:09:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/worknotes-being-added-twice-is-user-is-has-multiple-roles/m-p/3492684#M6088</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2026-02-19T11:09:30Z</dc:date>
    </item>
  </channel>
</rss>

