<?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: Business rule to check the updated by is member of assignment group in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448178#M105104</link>
    <description>&lt;P&gt;HEllo Twinkle,&lt;/P&gt;
&lt;P&gt;sys_updated_by is not reference field. its taking th user_name . so you need to gliderecord the user table and fetch the sysid or you can check it their itself.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Please mark as Correct Answer/Helpful, if applicable.&lt;/STRONG&gt;&lt;BR /&gt;Thanks! &lt;BR /&gt;Abhishek Gardade&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2019 10:00:16 GMT</pubDate>
    <dc:creator>AbhishekGardade</dc:creator>
    <dc:date>2019-07-29T10:00:16Z</dc:date>
    <item>
      <title>Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448167#M105093</link>
      <description>&lt;P&gt;I have a requirement to make a custom field Respond set to true if the updated by is the member of current assignment group.Everything works fine except the if condition, &lt;STRONG&gt;if condition is not fulfilling&lt;/STRONG&gt;.&amp;nbsp; Below is the code for After update&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(function executeRule(current, previous /*null when async*/) {&lt;/P&gt;
&lt;P&gt;var a=current.sys_updated_by;&lt;BR /&gt; var b=current.assignment_group;&lt;BR /&gt; var c=gs.getUser();&lt;BR /&gt; gs.addInfoMessage(b);&lt;BR /&gt; gs.addInfoMessage(a);&lt;BR /&gt; if(current.sys_updated_by.isMemberOf(current.assignment_group))&lt;BR /&gt; {&lt;BR /&gt; gs.addInfoMessage('inside if loop');&lt;BR /&gt; current.u_responed=true;&lt;BR /&gt; &lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Twinkle&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:34:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448167#M105093</guid>
      <dc:creator>Twinkle S</dc:creator>
      <dc:date>2019-07-29T09:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448168#M105094</link>
      <description>&lt;P&gt;Hello Twinkl,&lt;BR /&gt;Check out the below code: You missed current.update().&lt;/P&gt;
&lt;P&gt;var a=current.sys_updated_by;&lt;BR /&gt;var b=current.assignment_group;&lt;BR /&gt;&lt;STRONG&gt;var c=gs.getUserID();&lt;/STRONG&gt;&lt;BR /&gt;gs.addInfoMessage(b);&lt;BR /&gt;gs.addInfoMessage(a);&lt;BR /&gt;if(a.isMemberOf(current.assignment_group))&lt;BR /&gt;{&lt;BR /&gt;gs.addInfoMessage('inside if loop');&lt;BR /&gt;current.u_responed=true;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;current.setWorkflow(false);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;current.udpate();&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Please mark as Correct Answer/Helpful, if applicable.&lt;/STRONG&gt;&lt;BR /&gt;Thanks! &lt;BR /&gt;Abhishek Gardade&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:37:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448168#M105094</guid>
      <dc:creator>AbhishekGardade</dc:creator>
      <dc:date>2019-07-29T09:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448169#M105095</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In If condition you need to use &lt;STRONG&gt;c&lt;/STRONG&gt;.isMemberOf() instead of a.isMemberOf().&lt;/P&gt;
&lt;P&gt;var a=current.sys_updated_by;&lt;BR /&gt;var b=current.assignment_group;&lt;BR /&gt;var c=gs.getUser();&lt;BR /&gt;gs.addInfoMessage(b);&lt;BR /&gt;gs.addInfoMessage(a);&lt;BR /&gt;if(&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;c&lt;/STRONG&gt;&lt;/SPAN&gt;.isMemberOf(current.assignment_group))&lt;BR /&gt;{&lt;BR /&gt;gs.addInfoMessage('inside if loop');&lt;BR /&gt;current.u_responed=true;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:38:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448169#M105095</guid>
      <dc:creator>amaradiswamy</dc:creator>
      <dc:date>2019-07-29T09:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448170#M105096</link>
      <description>&lt;P&gt;Also, switch BR to before update as using setWorkflow(false) may have negative impacts as per my previous experience&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:40:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448170#M105096</guid>
      <dc:creator>amaradiswamy</dc:creator>
      <dc:date>2019-07-29T09:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448171#M105097</link>
      <description>&lt;P&gt;try&amp;nbsp;if(gs.getUser().isMemberOf(current.assignment_group))&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:40:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448171#M105097</guid>
      <dc:creator>Ahmmed Ali</dc:creator>
      <dc:date>2019-07-29T09:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448172#M105098</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I dont want to check the getUser . I need to check updated by. Also, the setworkflow() will only work only if the codition is matched. The if condition itself is not fulfilling&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:42:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448172#M105098</guid>
      <dc:creator>Twinkle S</dc:creator>
      <dc:date>2019-07-29T09:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448173#M105099</link>
      <description>&lt;P&gt;try now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="ng-scope"&gt;(function executeRule(current, previous /*null when async*/) {&lt;/P&gt;
&lt;P class="ng-scope"&gt;var a=current.sys_updated_by; // this field return the user_id so you have to glide record here to get the sysid.&lt;/P&gt;
&lt;P class="ng-scope"&gt;var gr = new GlideRecord('sys_user');&lt;/P&gt;
&lt;P class="ng-scope"&gt;gr.addQuery('user_name',a);&lt;/P&gt;
&lt;P class="ng-scope"&gt;gr.query();&lt;/P&gt;
&lt;P class="ng-scope"&gt;if(gr.next()){&lt;/P&gt;
&lt;P class="ng-scope"&gt;var res = gr.sys_id;&lt;/P&gt;
&lt;P class="ng-scope"&gt;&lt;BR /&gt;var b=current.assignment_group;&lt;BR /&gt;&lt;STRONG&gt;var c=gs.getUserID();&lt;/STRONG&gt;&lt;BR /&gt;gs.addInfoMessage(b);&lt;BR /&gt;gs.addInfoMessage(a);&lt;BR /&gt;if(&lt;STRONG&gt;res&lt;/STRONG&gt;.isMemberOf(current.assignment_group))&lt;BR /&gt;{&lt;BR /&gt;gs.addInfoMessage('inside if loop');&lt;BR /&gt;current.u_responed=true;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;
&lt;P class="ng-scope"&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:43:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448173#M105099</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2019-07-29T09:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448174#M105100</link>
      <description>&lt;P&gt;Try this code now:&lt;/P&gt;
&lt;P&gt;var a=current.sys_updated_by;&lt;BR /&gt;var b=current.assignment_group;&lt;BR /&gt;&lt;STRONG&gt;var c=gs.getUserID();&lt;/STRONG&gt;&lt;BR /&gt;gs.addInfoMessage(b);&lt;BR /&gt;gs.addInfoMessage(a);&lt;BR /&gt;if(a.isMemberOf(current.assignment_group))&lt;BR /&gt;{&lt;BR /&gt;gs.addInfoMessage('inside if loop');&lt;BR /&gt;current.u_responed=true;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;current.setWorkflow(false);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;current.udpate();&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:45:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448174#M105100</guid>
      <dc:creator>AbhishekGardade</dc:creator>
      <dc:date>2019-07-29T09:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448175#M105101</link>
      <description>&lt;P&gt;Nope. Not happening.Its not going inside the if loop&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:49:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448175#M105101</guid>
      <dc:creator>Twinkle S</dc:creator>
      <dc:date>2019-07-29T09:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448176#M105102</link>
      <description>&lt;P&gt;can you put some log and validate it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;
var a=current.sys_updated_by; 

gs.log('Updated By is'+ a);

var gr = new GlideRecord('sys_user');

gr.addQuery('user_name',a);

gr.query();
gs.log('Row Count+ gr.getRowCount());
if(gr.next()){

var res = gr.sys_id;


var b=current.assignment_group;
var c=gs.getUserID();
gs.addInfoMessage(b);
gs.addInfoMessage(a);
if(res.isMemberOf(current.assignment_group))
{
gs.log('Comimng inside if block ');
gs.addInfoMessage('inside if loop');
current.u_responed=true;

}

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:53:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448176#M105102</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2019-07-29T09:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448177#M105103</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;make it more simple.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try with below sample code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;	if(gs.getUser().getUserByID(current.sys_updated_by).isMemberOf(current.assignment_group)){

		gs.log('inside if');
current.u_responed=true;
	}

	else {
		
		gs.log('hey else');
	}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: Make sure you have written before business rule on UPDATE and you don't need to use current.update().&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 09:59:34 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448177#M105103</guid>
      <dc:creator>hvrdhn88</dc:creator>
      <dc:date>2019-07-29T09:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Business rule to check the updated by is member of assignment group</title>
      <link>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448178#M105104</link>
      <description>&lt;P&gt;HEllo Twinkle,&lt;/P&gt;
&lt;P&gt;sys_updated_by is not reference field. its taking th user_name . so you need to gliderecord the user table and fetch the sysid or you can check it their itself.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Please mark as Correct Answer/Helpful, if applicable.&lt;/STRONG&gt;&lt;BR /&gt;Thanks! &lt;BR /&gt;Abhishek Gardade&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 10:00:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/business-rule-to-check-the-updated-by-is-member-of-assignment/m-p/1448178#M105104</guid>
      <dc:creator>AbhishekGardade</dc:creator>
      <dc:date>2019-07-29T10:00:16Z</dc:date>
    </item>
  </channel>
</rss>

