<?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: Set Impact based on service in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3396609#M1231501</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/768783"&gt;@menardJA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;write a onchange client script and Script include to achieve this,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Script Include (client callable checked)&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;getBusinessServicePriority : function()
{
var getBusiness = this.getParameter('sysparm_sys_id');
var sr = new GlideRecord('cmdb_ci_service');
sr.addQuery('sys_id',getBusiness);
sr.query();
if(sr.next())
{
return sr.busines_criticality.toString();
}
},&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Client SCript onchange on Service field&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

var getServiceName = g_form.getValue('business_service');
var ga = new GlideAjax('demoAjax');
ga.addParam('sysparm_name', 'getBusinessServicePriority');
ga.addParam('sysparm_sys_id', getServiceName);
ga.getXML(serverResponse);

}
function serverResponse(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
if(answer == '2 - somewhat critical')
{
g_form.setValue('priority',1);
}

else if(answer == 'your value')
{
g_form.setValue('priority',2);
}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Oct 2025 04:49:42 GMT</pubDate>
    <dc:creator>shubhamseth</dc:creator>
    <dc:date>2025-10-03T04:49:42Z</dc:date>
    <item>
      <title>Set Impact based on service</title>
      <link>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3395797#M1231361</link>
      <description>&lt;P&gt;I have a requirement to have Impact on incidents set automatically based on the selected service then have a drop down where Help Desk can indicate how many users are impacted which would either lower or increase the impact based on the choice so if something has a default impact of 1 but is only affecting a single user it will drop to a 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a Business Impact field on my business services and created a catalog client script that is supposed to read the value and then set the impact value but the impact never changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone ever done this before? Any tips or guides?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2025 20:50:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3395797#M1231361</guid>
      <dc:creator>menardJA</dc:creator>
      <dc:date>2025-10-01T20:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Impact based on service</title>
      <link>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3396609#M1231501</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/768783"&gt;@menardJA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;write a onchange client script and Script include to achieve this,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Script Include (client callable checked)&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;getBusinessServicePriority : function()
{
var getBusiness = this.getParameter('sysparm_sys_id');
var sr = new GlideRecord('cmdb_ci_service');
sr.addQuery('sys_id',getBusiness);
sr.query();
if(sr.next())
{
return sr.busines_criticality.toString();
}
},&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Client SCript onchange on Service field&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

var getServiceName = g_form.getValue('business_service');
var ga = new GlideAjax('demoAjax');
ga.addParam('sysparm_name', 'getBusinessServicePriority');
ga.addParam('sysparm_sys_id', getServiceName);
ga.getXML(serverResponse);

}
function serverResponse(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
if(answer == '2 - somewhat critical')
{
g_form.setValue('priority',1);
}

else if(answer == 'your value')
{
g_form.setValue('priority',2);
}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2025 04:49:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3396609#M1231501</guid>
      <dc:creator>shubhamseth</dc:creator>
      <dc:date>2025-10-03T04:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Set Impact based on service</title>
      <link>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3398942#M1231899</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/382082"&gt;@shubhamseth&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tweaked the scripts slightly to fit what I had the variables as on my instance however the impact is not updating when I select a Service&lt;/P&gt;&lt;P&gt;Script include&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var getBusinessServicePriority = Class.create();
getBusinessServicePriority.prototype = Object.extendsObject(AbstractAjaxProcessor, {
   // Returns the numeric value (1/2/3) from u_business_impact on the Business Service
   getBusinessServicePriority: function () {
       var serviceSysId = this.getParameter('sysparm_sys_id');
       if (!serviceSysId) return '';
       var svc = new GlideRecord('cmdb_ci_service');
       if (svc.get(serviceSysId)) {
           // Return the VALUE (e.g., "1", "2", "3")
           return String(svc.getValue('u_business_impact') || '');
           // If you actually need the LABEL, switch to:
           // return String(svc.getDisplayValue('u_business_impact') || '');
       }
       return '';
   },
   type: 'getBusinessServicePriority'
});&lt;/LI-CODE&gt;&lt;P&gt;Client Script&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || isTemplate || !newValue) return;
   var ga = new GlideAjax('getBusinessServicePriority');
   ga.addParam('sysparm_name', 'getBusinessServicePriority');
   ga.addParam('sysparm_sys_id', newValue);
   ga.getXMLAnswer(function(answer) {
       if (!answer) return;
       // If Script Include returned the numeric VALUE ("1","2","3"):
       var impactNum = parseInt(answer, 10);
       if (!isNaN(impactNum)) {
           // Incident.impact expects 1/2/3 by default (High/Medium/Low)
           g_form.setValue('impact', impactNum);
           return;
       }
       // If Script Include was changed to return the LABEL (e.g., "1 - High"):
       var match = (answer || '').match(/^(\d+)/);
       if (match) {
           g_form.setValue('impact', parseInt(match[1], 10));
       }
   });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Oct 2025 15:49:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/set-impact-based-on-service/m-p/3398942#M1231899</guid>
      <dc:creator>menardJA</dc:creator>
      <dc:date>2025-10-06T15:49:41Z</dc:date>
    </item>
  </channel>
</rss>

