<?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 Before Query Business Rule Incident in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446543#M18322</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking to create a before business rule query that involves only snc_internal users. We have different departments that require access to incidents when a user from either department A or department B submits an incident with a specific category on our service portal. We attempted the a read ACL route and is populating the correct data, but is very clunky for the end users. They have to sift through pages of incidents where it tells the user that "10 records have been restricted" etc. I think a before business rule query with the same condition would be a better approach. The issue is that we would have to build this condition based on department. My thought was to clone the OOB "Incident Query" and alter the condition based on our requirements.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any guidance on how to script this by department would help tremendously. Any other tips or insight on other methods to achieve this goal would also be welcomed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jan 2022 01:44:20 GMT</pubDate>
    <dc:creator>Cobee</dc:creator>
    <dc:date>2022-01-22T01:44:20Z</dc:date>
    <item>
      <title>Before Query Business Rule Incident</title>
      <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446543#M18322</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking to create a before business rule query that involves only snc_internal users. We have different departments that require access to incidents when a user from either department A or department B submits an incident with a specific category on our service portal. We attempted the a read ACL route and is populating the correct data, but is very clunky for the end users. They have to sift through pages of incidents where it tells the user that "10 records have been restricted" etc. I think a before business rule query with the same condition would be a better approach. The issue is that we would have to build this condition based on department. My thought was to clone the OOB "Incident Query" and alter the condition based on our requirements.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any guidance on how to script this by department would help tremendously. Any other tips or insight on other methods to achieve this goal would also be welcomed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 01:44:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446543#M18322</guid>
      <dc:creator>Cobee</dc:creator>
      <dc:date>2022-01-22T01:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Before Query Business Rule Incident</title>
      <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446544#M18323</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;as you did not provide enough details, I cannot answer your question.&lt;/P&gt;
&lt;P&gt;But you can watch the following video to get an idea on how to implement a respective Before Query Business Rule.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=Xtj9nvnryr8&amp;amp;list=PLkGSnjw5y2U5jTsF7i2yRZPdk3lm88SN8&amp;amp;index=26" target="_blank"&gt;https://www.youtube.com/watch?v=Xtj9nvnryr8&amp;amp;list=PLkGSnjw5y2U5jTsF7i2yRZPdk3lm88SN8&amp;amp;index=26&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;BR /&gt;Maik&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 02:00:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446544#M18323</guid>
      <dc:creator>Maik Skoddow</dc:creator>
      <dc:date>2022-01-22T02:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Before Query Business Rule Incident</title>
      <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446545#M18324</link>
      <description>&lt;P&gt;Hi, consider to use the script below (to be added to the advanced tab of Before Query BR).&lt;/P&gt;
&lt;P&gt;It forces users from HR and IT departments to only see incidents, raised for Software category and by callers from either Finance or Product management departments.&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;(function executeRule(current, previous /*null when async*/) {
   // Add your code here
   if (userIsInDepartments()) {
	   current.addEncodedQuery('caller_id.department=a581ab703710200044e0bfc8bcbe5de8^ORcaller_id.department=9a7ed3f03710200044e0bfc8bcbe5db7^category=software');
   }

function userIsInDepartments() {
 var gr= new GlideRecord('sys_user');
 gr.get(gs.getUserID());
 if (gr.department.name.toString()=='HR' || gr.department.name.toString()=='IT')
   return true; 
}
})(current, previous);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope it helps&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 11:56:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446545#M18324</guid>
      <dc:creator>Appli</dc:creator>
      <dc:date>2022-01-22T11:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Before Query Business Rule Incident</title>
      <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446546#M18325</link>
      <description>&lt;P&gt;Thanks for the quick and detailed response. I have tried this method and was not successful on our instance. I think we are still having conflicts with OOB incident Business Rules. The users in question here do not have roles associated with their accounts, only snc_internal. So I think we are limited to what can be accomplished when viewing other department records. We will keep troubleshooting.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 17:41:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446546#M18325</guid>
      <dc:creator>Cobee</dc:creator>
      <dc:date>2022-01-25T17:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Before Query Business Rule Incident</title>
      <link>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446547#M18326</link>
      <description>&lt;P&gt;Hi, agree - but if it is about viewing records, consider to&amp;nbsp;apply ITSM specific role&amp;nbsp; sn_incident_read to these users; it should grant them an access to incidents however BR will still restrict an access as per script above.&lt;/P&gt;
&lt;P&gt;Hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 19:03:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/before-query-business-rule-incident/m-p/446547#M18326</guid>
      <dc:creator>Appli</dc:creator>
      <dc:date>2022-01-25T19:03:36Z</dc:date>
    </item>
  </channel>
</rss>

