<?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 How to downgrade incident priority using a run script on a transform map? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-downgrade-incident-priority-using-a-run-script-on-a/m-p/2956032#M1120359</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am working with a type of incident which is created by being transformed through a transform map and I want to prevent Critical incidents from being created.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any incident that comes in that is Critical should be downgraded to High instead. Is the best way to do this is via a run script on the transform map?&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 11:02:47 GMT</pubDate>
    <dc:creator>Kiran_25</dc:creator>
    <dc:date>2024-06-07T11:02:47Z</dc:date>
    <item>
      <title>How to downgrade incident priority using a run script on a transform map?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-downgrade-incident-priority-using-a-run-script-on-a/m-p/2956032#M1120359</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am working with a type of incident which is created by being transformed through a transform map and I want to prevent Critical incidents from being created.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any incident that comes in that is Critical should be downgraded to High instead. Is the best way to do this is via a run script on the transform map?&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 11:02:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-downgrade-incident-priority-using-a-run-script-on-a/m-p/2956032#M1120359</guid>
      <dc:creator>Kiran_25</dc:creator>
      <dc:date>2024-06-07T11:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to downgrade incident priority using a run script on a transform map?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-downgrade-incident-priority-using-a-run-script-on-a/m-p/2956043#M1120361</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&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;Yes, using a script on the transform map is an effective way to achieve this. By adding a script to your transform map, you can manipulate the data before it is inserted into the target table. Here's a step-by-step approach to implement this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Open the Transform Map&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Navigate to System Import Sets &amp;gt; Administration &amp;gt; Transform Maps.&lt;/LI&gt;&lt;LI&gt;Open the relevant transform map.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Add a Script&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In the transform map, locate the Field Maps section.&lt;/LI&gt;&lt;LI&gt;Add a new field map or edit an existing one for the priority field (assuming priority is the field indicating the incident's severity).&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Write the Script&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use a script to check the value of the priority and downgrade it if it is set to Critical.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here is an example script that you can use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;(function transformEntry(source, target, map, log, isUpdate) {
    // Check if the priority field in the source data is 'Critical'
    if (source.priority === 'Critical') {
        // Change the target priority to 'High'
        target.priority = 'High';
    } else {
        // Otherwise, set the target priority to the source priority
        target.priority = source.priority;
    }
})(source, target, map, log, isUpdate);&lt;/LI-CODE&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;If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amitoj Wadhera&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 11:08:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-downgrade-incident-priority-using-a-run-script-on-a/m-p/2956043#M1120361</guid>
      <dc:creator>Amitoj Wadhera</dc:creator>
      <dc:date>2024-06-07T11:08:56Z</dc:date>
    </item>
  </channel>
</rss>

