<?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: How to update sys_class_name via Transform Map script? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363132#M20058</link>
    <description>&lt;P&gt;Unless someone has a clever solution, I always import CIs class-by-class, your issue being one of the reasons; sys_class_name is set by the system automatically based on the target table you pick.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;Please feel free to connect, follow, mark helpful / answer, like, endorse.&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="width: 172px;"&gt;John Chun, &lt;SPAN style="font-size: 8pt;"&gt;PhD PMP&lt;/SPAN&gt; &lt;A href="http://linkedin.com/in/DrJohnChun"&gt;&lt;IMG alt="see John's LinkedIn profile" class="image-2 jive-image" src="http://megaicons.net/static/img/icons_sizes/182/456/16/linkedin-icon.png" style="height: auto; vertical-align: -13px;" title="see John's LinkedIn profile" /&gt;&lt;/A&gt;&lt;P&gt;&lt;A href="http://snowaid.com/"&gt;&lt;IMG alt="visit snowaid" class="image-1 jive-image" src="http://snowaid.com/images/signature.png" style="height: auto; margin-top: -9px;" title="visit snowaid" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;&lt;A _jive_internal="true" href="https://www.servicenow.com/people/drjohnchun/content"&gt;&lt;IMG alt="ServiceNow Advocate" class="image-3 jive-image" src="http://snowaid.com/images/sn_advocate_135x48.png" style="margin-top: -3px;" /&gt;&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;A title="" _jive_internal="true" href="https://www.servicenow.com/community?id=community_forum&amp;amp;sys_id=76299a2ddbd897c068c1fb651f96196a"&gt;Winner of November 2016 Members' Choice Award&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 09 Dec 2016 20:31:14 GMT</pubDate>
    <dc:creator>drjohnchun</dc:creator>
    <dc:date>2016-12-09T20:31:14Z</dc:date>
    <item>
      <title>How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363131#M20057</link>
      <description>&lt;P&gt;I am trying to import some records into cmdb_ci table. My excel sheet does have a column Class=Computer. But in transform map, when I do an Auto mapping.. I could not find the sys_class_name field in my target table. &amp;nbsp; So, in the run script block, I wrote the following assuming it will update the Class along with other columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;target.sys_class_name = source.u_class; //Did not work -------------need help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be more accurate, I updated my excel file to have values 'cmdb_ci_computer' for Class column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, it does not take this value. It shows the Class as 'Configuration Item'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need help please.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 20:19:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363131#M20057</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2016-12-09T20:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363132#M20058</link>
      <description>&lt;P&gt;Unless someone has a clever solution, I always import CIs class-by-class, your issue being one of the reasons; sys_class_name is set by the system automatically based on the target table you pick.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;Please feel free to connect, follow, mark helpful / answer, like, endorse.&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="width: 172px;"&gt;John Chun, &lt;SPAN style="font-size: 8pt;"&gt;PhD PMP&lt;/SPAN&gt; &lt;A href="http://linkedin.com/in/DrJohnChun"&gt;&lt;IMG alt="see John's LinkedIn profile" class="image-2 jive-image" src="http://megaicons.net/static/img/icons_sizes/182/456/16/linkedin-icon.png" style="height: auto; vertical-align: -13px;" title="see John's LinkedIn profile" /&gt;&lt;/A&gt;&lt;P&gt;&lt;A href="http://snowaid.com/"&gt;&lt;IMG alt="visit snowaid" class="image-1 jive-image" src="http://snowaid.com/images/signature.png" style="height: auto; margin-top: -9px;" title="visit snowaid" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;&lt;A _jive_internal="true" href="https://www.servicenow.com/people/drjohnchun/content"&gt;&lt;IMG alt="ServiceNow Advocate" class="image-3 jive-image" src="http://snowaid.com/images/sn_advocate_135x48.png" style="margin-top: -3px;" /&gt;&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;A title="" _jive_internal="true" href="https://www.servicenow.com/community?id=community_forum&amp;amp;sys_id=76299a2ddbd897c068c1fb651f96196a"&gt;Winner of November 2016 Members' Choice Award&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Dec 2016 20:31:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363132#M20058</guid>
      <dc:creator>drjohnchun</dc:creator>
      <dc:date>2016-12-09T20:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363133#M20059</link>
      <description>&lt;P&gt;&lt;STRONG&gt;It is possible&lt;/STRONG&gt; to use the transform map to set the class type. The transform map in my example has the target table set to &lt;EM&gt;cmdb_ci_server&lt;/EM&gt; and the script associated with the transform map uses &amp;nbsp; columns defined in the data source (in this example called &lt;EM&gt;product&lt;/EM&gt; and &lt;EM&gt;operating_system&lt;/EM&gt;) to select the most appropriate target class.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;The only restriction that I found when performing this type of "upgrade" class operation is that the field mapping will only support the "BASE" class attributes (in my case &lt;EM&gt;cmdb_ci_server&lt;/EM&gt; attributes) and not those in the derived classes.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;---SNIP---&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var devType = source.u_product.toString().toUpperCase();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var operating_system = source.u_operating_system.toString().toUpperCase();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if (devType == "WINDOWS SERVER"){ target.sys_class_name="cmdb_ci_win_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;else if (devType == "UNIX"){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; if (operating_system == "HP-UX"){ target.sys_class_name="cmdb_ci_hpux_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; else if (operating_system.match(/SUNOS/i) != null){ target.sys_class_name="cmdb_ci_solaris_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; else if (operating_system.match(/AIX/i) != null){ target.sys_class_name="cmdb_ci_aix_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; else if (operating_system.match(/LINUX/i) != null){ target.sys_class_name="cmdb_ci_linux_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; else {target.sys_class_name="cmdb_ci_unix_server"} //just unix&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;else if (devType.match(/NETWARE/i) != null){ target.sys_class_name="cmdb_ci_netware_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;else if (devType.match(/DARWIN/i) != null){ target.sys_class_name="cmdb_ci_osx_server"; }&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Andy Trayler&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 16 May 2017 17:24:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363133#M20059</guid>
      <dc:creator>andy_trayler</dc:creator>
      <dc:date>2017-05-16T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363134#M20060</link>
      <description>&lt;P&gt;target.sys_class_name="cmdb_ci_hpux_server"; worked for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 14:30:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363134#M20060</guid>
      <dc:creator>Alex Heinen</dc:creator>
      <dc:date>2018-05-01T14:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363135#M20061</link>
      <description>&lt;P&gt;I performed a simple import, containing two server classes (Windows and Linux) into the cmdb_ci_server table. The values in my import file were "Windows Server" and "Linux Server" and these had to be changed upon import to "cmdb_ci_win_server" and "cmdb_ci_linux_server", respectively, as these are the actual values for the Class field in the table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/139878iAD58EB86E9678387/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The short script to transform the values in the import file:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/139882i193CE31F1D623DF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 16:08:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363135#M20061</guid>
      <dc:creator>Jason Nichols</dc:creator>
      <dc:date>2018-06-28T16:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363136#M20062</link>
      <description>&lt;P&gt;I know this is an old post but I came up with a solution for this with the following code:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;answer = (function transformEntry(source) {&lt;/P&gt;
&lt;P&gt;var tab = new GlideRecord('sys_choice');&lt;BR /&gt; tab.addEncodedQuery('elementSTARTSWITHsys_class_name^labelLIKE' + source.u_class);&lt;BR /&gt; tab.query();&lt;BR /&gt; if(tab.next()){&lt;BR /&gt; return tab.value; // return the value to be put into the target field&lt;BR /&gt; }&lt;BR /&gt;})(source);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has worked using the table label value and successfully changes the target dependent on that value and allowed an import of over 20k CI's to numerous tables in one import.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps someone else &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 08:31:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363136#M20062</guid>
      <dc:creator>Rob4</dc:creator>
      <dc:date>2020-05-18T08:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to update sys_class_name via Transform Map script?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363137#M20063</link>
      <description>&lt;P&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:37:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-update-sys-class-name-via-transform-map-script/m-p/1363137#M20063</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2020-05-21T16:37:32Z</dc:date>
    </item>
  </channel>
</rss>

