<?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: Need help on importing Business Capability in Enterprise Architecture forum</title>
    <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004560#M104</link>
    <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="066f4269db181fc09c9ffb651f961995"&gt;@mcastoe&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so very much for the script and explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I followed your steps and i am able to import Combined sheet along with order in the new custom table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I copied your script and added in the fix script before running i disable the custom&amp;nbsp;use_business_capability_custom_hierarchy_id property to true as suggested in the docs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Later when i run the i am getting an error sir, i tried understanding the error but i think this is occurring because of duplicate order then i inactivate the BR '&lt;A class="linked formlink" href="https://dev61954.service-now.com/sys_script.do?sys_id=b7f3022ddb132300e81171d8f0b8f561&amp;amp;sysparm_record_target=sys_script&amp;amp;sysparm_record_row=1&amp;amp;sysparm_record_rows=27&amp;amp;sysparm_record_list=collection%3Dcmdb_ci_business_capability%5EORcollectionINcmdb_ci_business_capability%2Ccmdb_ci%2Ccmdb%5EORDERBYDESCsys_updated_on"&gt;Check for duplicate order&lt;/A&gt;' when i run the fix script i see the error again &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;*** Script: [APQC IMPORT] Begin APQC Capability Import
GlideSession message was modified by sanitization. [message=java.sql.BatchUpdateException: (conn=6059) Duplicate entry &amp;amp;apos;1.00&amp;amp;apos; for key &amp;amp;apos;a_num_10&amp;amp;apos;][sanitized=java.sql.BatchUpdateException: (conn&amp;amp;#61;6059) Duplicate entry &amp;amp;#39;1.00&amp;amp;#39; for key &amp;amp;#39;a_num_10&amp;amp;#39;]
FAILED TRYING TO EXECUTE ON CONNECTION glide.8 (connpid=6059): INSERT INTO cmdb (`a_str_14`,`skip_sync`,`operational_status`,`sys_updated_on`,`can_print`,`sys_class_name`,`sys_id`,`sys_updated_by`,`sys_class_path`,`sys_created_on`,`sys_domain`,`sys_created_by`,`a_num_10`,`a_bln_2`,`sys_mod_count`,`a_bln_1`,`monitor`,`sys_domain_path`,`a_bln_3`,`cost_cc`,`install_status`,`name`,`attested`,`unverified`,`correlation_id`,`fault_count`,`a_int_1`) VALUES('1.0',0,1,'2021-05-14 20:23:00',0,'cmdb_ci_business_capability','281badbe2f4870108bea56f62799b687','admin','/!!/#+','2021-05-14 20:23:00','global','admin',1,1,0,1,0,'/',1,'USD',1,'Develop Vision and Strategy',0,0,'1.0',0,0),INSERT INTO cmdb$par1 (`operational_status`,`sys_updated_on`,`sys_class_name`,`sys_id`,`sys_updated_by`,`sys_class_path`,`sys_created_on`,`sys_domain`,`sys_created_by`,`sys_mod_count`,`sys_domain_path`,`install_status`,`name`) VALUES(1,'2021-05-14 20:23:00','cmdb_ci_business_capability','281badbe2f4870108bea56f62799b687','admin','/!!/#+','2021-05-14 20:23:00','global','admin',0,'/',1,'Develop Vision and Strategy')
java.sql.BatchUpdateException: (conn=6059) Duplicate entry '1.00' for key 'a_num_10'
: java.sql.SQLException: java.sql.BatchUpdateException: (conn=6059) Duplicate entry '1.00' for key 'a_num_10': com.glide.db.StatementBatcher.getSQLException(StatementBatcher.java:643)
com.glide.db.StatementBatcher.commitBatch(StatementBatcher.java:595)
com.glide.db.StatementBatcher.commitAllOrNothing(StatementBatcher.java:469)
com.glide.db.DBCompositeAction.executeAsBatch(DBCompositeAction.java:228)
com.glide.db.DBCompositeAction.executeChunk(DBCompositeAction.java:171)
com.glide.db.DBCompositeAction.executeAsResultSet0(DBCompositeAction.java:108)
com.glide.db.DBAction.executeAndReturnTable(DBAction.java:267)
com.glide.db.DBAction.executeNormal(DBAction.java:256)
com.glide.db.DBAction.executeAndReturnException(DBAction.java:210)
com.glide.script.GlideRecordITable.insert(GlideRecordITable.java:158)
com.glide.script.GlideRecord.insert(GlideRecord.java:4971)
com.glide.script.GlideRecord.insert(GlideRecord.java:4881)
com.glide.script.GlideRecord.jsFunction_insert(GlideRecord.java:5425)
sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2609)
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
org.mozilla.javascript.gen._refname__4026._c_createCapability_1(&amp;lt;refname&amp;gt;:68)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2678)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2617)
org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
org.mozilla.javascript.gen._refname__4026._c_script_0(&amp;lt;refname&amp;gt;:38)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3459)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.gen._refname__4026.exec(&amp;lt;refname&amp;gt;)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73)
com.glide.script.Evaluator.evaluateString(Evaluator.java:96)
com.glide.update.UpdateManager2.testFixScript(UpdateManager2.java:750)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.runFixScript(ScriptFixXMLHttpProcessor.java:173)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.evaluateScript(ScriptFixXMLHttpProcessor.java:151)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.startWork(ScriptFixXMLHttpProcessor.java:126)
com.glide.worker.AbstractProgressWorker.startAndWait(AbstractProgressWorker.java:126)
com.glide.worker.ProgressWorker.startAndWait(ProgressWorker.java:52)
com.glide.worker.AbstractProgressWorker.start(AbstractProgressWorker.java:101)
com.snc.apps.ScriptFixXMLHttpProcessor.process(ScriptFixXMLHttpProcessor.java:87)
com.glide.processors.XMLHttpProcessor.processJavaAJAX(XMLHttpProcessor.java:168)
com.glide.processors.XMLHttpProcessor.process(XMLHttpProcessor.java:121)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:576)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:264)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:181)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:169)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:44)
com.glide.sys.Transaction.run(Transaction.java:2228)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

*** Script: [APQC IMPORT] APQC Capability Import complete, 1.0 loaded 
[0:00:00.167] Total Time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do i need to inactive any Business rules or i think some of Business Capability have the same name like "Develop Vision and Strategy" was this causing the issue to run the scirpt ?&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 20:28:23 GMT</pubDate>
    <dc:creator>shaik_irfan</dc:creator>
    <dc:date>2021-05-14T20:28:23Z</dc:date>
    <item>
      <title>Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004552#M96</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am really need of some expert suggestions, i have some bunch of data provided by customer from APQC to import as Business Capabilities and have a data mapped correctly with hierarchy and dependencies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have more than 20+K records, i really do not any idea how to import this. I am attaching some sample data similar to what i have can anyone please help me how to get this done ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="eac25221db1c1fc09c9ffb651f9619c0"&gt;@mark_b&lt;/SN-MENTION&gt;&amp;nbsp;Can you please help me in loading the data with mapping&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:48:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004552#M96</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-11T19:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004553#M97</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have used two different method for dealing with APQC capabilities.&lt;/P&gt;
&lt;P&gt;You will want to use the APQC Hierarchy IDs rather than the system generated ID.&amp;nbsp; See this link in docs to disable ID generation:&amp;nbsp;&lt;A title="Create business capability and relate the capability with an application" href="https://docs.servicenow.com/bundle/quebec-it-business-management/page/product/application-portfolio-management/task/create-a-business-capability.html"&gt;Create business capability and relate the capability with an application&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;First is what i would classify as Excel manipulation + "layered" imports.&amp;nbsp; I take the "Combined" sheet in the APQC data and using a couple formulas in columns to right of&amp;nbsp;the&amp;nbsp;core APQC columns, parse the APQC Hierarchy ID to determine the level of the capability (0-4) and the Hierarchy ID of the capabilities parent capability.&amp;nbsp; Once&amp;nbsp;you&amp;nbsp;have these, separate&amp;nbsp;each&amp;nbsp;level "set" into separate excel workbooks per level with a single&amp;nbsp;sheet with Capability Hierarchy ID, Name and Parent as column.&amp;nbsp; Note that level 0 capabilities will have no parent.&amp;nbsp; &amp;nbsp;Create an import set and import one set at a time starting with level 0.&amp;nbsp; Level 0, you&amp;nbsp;can&amp;nbsp;ignore the Parent column.&amp;nbsp; For subsequent levels, use a script in&amp;nbsp;the&amp;nbsp;transform map to locate the parent by Hierarchy ID.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option I've used is to import the whole Combined sheet into a custom table, then write a fix script to parse the table, the data coming in from Excel is properly sorted and so for each row that has a Hierarchy ID of the pattern ##.0, you create a level 0 business capability, for others, you locate the parent, which should already exist and set the parent appropriately.&amp;nbsp; This method is actually quicker once you have it coded but of course you need the admin level permissions to create a custom table and the fix script.&amp;nbsp; &amp;nbsp;I've done it locally in a PDI and then exported and imported via Excel.&lt;/P&gt;
&lt;P&gt;I hope this helps,&lt;BR /&gt;Mark&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 May 2021 16:17:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004553#M97</guid>
      <dc:creator>mcastoe</dc:creator>
      <dc:date>2021-05-12T16:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004554#M98</link>
      <description>&lt;P&gt;Thank you very much &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="1443af50dbd6b3004819fb24399619ce"&gt;@mcastoe&lt;/SN-MENTION&gt;&amp;nbsp;. I think I can do the second option as playing with excel formulas is tricky and since I need to show to client first at my PDI instance I can create a table as I am admin. If you please don't mind can you share me the fix script you talking. It would be more helpful for me&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 21:11:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004554#M98</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-12T21:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004555#M99</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;unfortunately that old PDI has&amp;nbsp;retired.&amp;nbsp; &amp;nbsp;I will see if i can recreate.&amp;nbsp; Another thing i remember is that i remember is that i added a column to the sheet before import named "order" and it was a simply a sequence from 1 - however many to insure i got the right sorting as you cannot sort on Hierarchy ID.&lt;/P&gt;
&lt;P&gt;Mark&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 May 2021 12:30:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004555#M99</guid>
      <dc:creator>mcastoe</dc:creator>
      <dc:date>2021-05-13T12:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004556#M100</link>
      <description>&lt;P&gt;Thank You &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="066f4269db181fc09c9ffb651f961995"&gt;@mcastoe&lt;/SN-MENTION&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes i did imported the sheet in my PDI and had a order column added &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; But its little difficult to understand the hierarchy terminology as i am not so mature on APM i hope you understand&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will wait for your reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 12:35:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004556#M100</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-13T12:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004557#M101</link>
      <description>&lt;P&gt;Yes, Mark captured the advice I would give, import in seperate layers, starting from the top then each subsequent layer under that.&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 May 2021 13:01:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004557#M101</guid>
      <dc:creator>markbodman</dc:creator>
      <dc:date>2021-05-13T13:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004558#M102</link>
      <description>&lt;P&gt;Thank you &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="d2bf8436db1e6450fa192183ca9619fe"&gt;@mark_b&lt;/SN-MENTION&gt;&amp;nbsp;for your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per Mark Castoe we need to run a fix script to align the parent business capabilities and level 0, by any chance do you have that fix script with you or any blog which i can refer ?&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 14:47:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004558#M102</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-13T14:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004559#M103</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hierarchies are not an APM thing; it's just a data concept or really a life concept.&amp;nbsp; So as far as the hierarchy, the way it works is essentially a parent-child organization of data.&amp;nbsp; The top capability 1.0 has children 1.1, 1.2, 1.3, and 1.1 has 1.1.1, 1.1.2 and so forth.&amp;nbsp; Each child has its parent attribute set to the parent.&amp;nbsp; Hope&amp;nbsp;that helps to explain the data concept.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the following script is an example of what you might do.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;/**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; APQC Capability Loader&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 1. Prepare you Excel by combining all the categories and their children in hierarchy into a single sheet. this script depends on the capabilities being in a depth-wise ordering&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 2. add a row for ordering 1-n&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 3. create a custom table to hold the APQC data, APQC_TBL in the variable below &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 4. import the apqc data into your custom table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 5. follow the instruction at the following to allow custom hierarchy ID on capabilities: https://docs.servicenow.com/bundle/quebec-it-business-management/page/product/application-portfolio-management/task/create-a-business-capability.html&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; 6. use this script as a model to build you own import script from the custom table to capability. &lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt; *** NOTE: this script is for educational purpose only and no guarantee or warranty is implied or given&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;**/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;var APQC_TBL = 'u_apqc_capability';&lt;BR /&gt;var BUS_CAP_TBL = 'cmdb_ci_business_capability';&lt;/P&gt;
&lt;P&gt;var apqc_gr = new GlideRecord(APQC_TBL);&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;// capabilities are ordered in hierarchy form starting with the first root and its children&amp;nbsp;and their children etc&lt;/SPAN&gt;&lt;BR /&gt;apqc_gr.orderBy('u_order');&lt;BR /&gt;apqc_gr.query();&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;// for each apqc row, create a capability&lt;/SPAN&gt;&lt;BR /&gt;gs.info('[APQC IMPORT] Begin APQC Capability Import');&lt;BR /&gt;var cnt = 0;&lt;BR /&gt;while(apqc_gr.next()) {&lt;BR /&gt; cnt++; &lt;BR /&gt; &lt;SPAN style="color: #339966;"&gt;//gs.info('[APQC IMPORT] Capability = {0} {1}, count is {2}', [apqc_gr.getValue('u_name'),apqc_gr.getValue('u_hierarchy_id'), cnt]);&lt;/SPAN&gt;&lt;BR /&gt; var h_id = apqc_gr.getValue('u_hierarchy_id');&lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color: #339966;"&gt;// if its not a root capability, get the parent&lt;/SPAN&gt;&lt;BR /&gt; var p_id = '';&lt;BR /&gt; var p_sys_id = null;&lt;BR /&gt; var ordr = null;&lt;BR /&gt; var istop = h_id.indexOf('.0');&lt;BR /&gt; if(istop &amp;lt; 0) {&lt;BR /&gt;&lt;BR /&gt; var lastnum = h_id.lastIndexOf('.');&lt;BR /&gt; p_id = h_id.substring(0,lastnum);&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN style="color: #339966;"&gt;// fix root level parents&lt;/SPAN&gt;&lt;BR /&gt; if(p_id.indexOf('.') &amp;lt; 0){&lt;BR /&gt; p_id = p_id + '.0';&lt;BR /&gt; }&lt;BR /&gt; p_sys_id = getParentCapabilitySysIdByHID(p_id);&lt;BR /&gt; } else {&lt;BR /&gt; ordr = h_id.substring(0,h_id.lastIndexOf('.'));&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; var newcid = createCapability(apqc_gr.getValue('u_name'),h_id,ordr,p_sys_id);&lt;BR /&gt; if(!newcid) {&lt;BR /&gt; break; &lt;SPAN style="color: #339966;"&gt;//&amp;nbsp;something went wrong so bail and investigate&lt;/SPAN&gt;&lt;BR /&gt; }&lt;BR /&gt; if((cnt % 100) == 0 ){&lt;BR /&gt; gs.info('[APQC IMPORT] - {0} APQC Capabilities imported', [cnt]);&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;gs.info('[APQC IMPORT] APQC Capability Import complete, {0} loaded ', [cnt]);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;// create capability&lt;/SPAN&gt;&lt;BR /&gt;function createCapability(name, hier_id, order, parent){&lt;BR /&gt; if(!name || !hier_id){&lt;BR /&gt; gs.info('[APQC IMPORT] ERROR, found a null name or hierarchy id, that cant be allowed...');&lt;BR /&gt; return null;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; var c_gr = new GlideRecord(BUS_CAP_TBL);&lt;BR /&gt; c_gr.initialize();&lt;BR /&gt; c_gr.setValue('name',name);&lt;BR /&gt; c_gr.setValue('hierarchy_id',hier_id);&lt;BR /&gt; c_gr.setValue('correlation_id',hier_id);&lt;BR /&gt; if(parent) {&lt;BR /&gt; c_gr.setValue('parent',parent);&lt;BR /&gt; } &lt;BR /&gt; if (order) {&lt;BR /&gt; c_gr.setValue('order',order);&lt;BR /&gt; }&lt;BR /&gt; var newid = c_gr.insert('create new capability record');&lt;BR /&gt; //gs.info('[APQC IMPORT] New Capability Created: {0} {1} {2}',[name, hier_id, newid]);&lt;BR /&gt; c_gr = null;&lt;BR /&gt; return newid;&lt;BR /&gt;}&lt;BR /&gt;&lt;SPAN style="color: #339966;"&gt;// get capability parent by hierarchy id&lt;/SPAN&gt;&lt;BR /&gt;function getParentCapabilitySysIdByHID (capId) {&lt;BR /&gt; &lt;SPAN style="color: #339966;"&gt;// note, when importing and referencing data it is always good to use the correlation id&lt;/SPAN&gt; instead of other attributes&lt;BR /&gt; var gr = new GlideRecord(BUS_CAP_TBL);&lt;BR /&gt; gr.addQuery('correlation_id', capId);&lt;BR /&gt; gr.query();&lt;BR /&gt; if(gr.next()){&lt;BR /&gt; return gr.sys_id;&lt;BR /&gt; } else {&lt;BR /&gt; return null;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 May 2021 13:54:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004559#M103</guid>
      <dc:creator>mcastoe</dc:creator>
      <dc:date>2021-05-14T13:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004560#M104</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="066f4269db181fc09c9ffb651f961995"&gt;@mcastoe&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so very much for the script and explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I followed your steps and i am able to import Combined sheet along with order in the new custom table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I copied your script and added in the fix script before running i disable the custom&amp;nbsp;use_business_capability_custom_hierarchy_id property to true as suggested in the docs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Later when i run the i am getting an error sir, i tried understanding the error but i think this is occurring because of duplicate order then i inactivate the BR '&lt;A class="linked formlink" href="https://dev61954.service-now.com/sys_script.do?sys_id=b7f3022ddb132300e81171d8f0b8f561&amp;amp;sysparm_record_target=sys_script&amp;amp;sysparm_record_row=1&amp;amp;sysparm_record_rows=27&amp;amp;sysparm_record_list=collection%3Dcmdb_ci_business_capability%5EORcollectionINcmdb_ci_business_capability%2Ccmdb_ci%2Ccmdb%5EORDERBYDESCsys_updated_on"&gt;Check for duplicate order&lt;/A&gt;' when i run the fix script i see the error again &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;*** Script: [APQC IMPORT] Begin APQC Capability Import
GlideSession message was modified by sanitization. [message=java.sql.BatchUpdateException: (conn=6059) Duplicate entry &amp;amp;apos;1.00&amp;amp;apos; for key &amp;amp;apos;a_num_10&amp;amp;apos;][sanitized=java.sql.BatchUpdateException: (conn&amp;amp;#61;6059) Duplicate entry &amp;amp;#39;1.00&amp;amp;#39; for key &amp;amp;#39;a_num_10&amp;amp;#39;]
FAILED TRYING TO EXECUTE ON CONNECTION glide.8 (connpid=6059): INSERT INTO cmdb (`a_str_14`,`skip_sync`,`operational_status`,`sys_updated_on`,`can_print`,`sys_class_name`,`sys_id`,`sys_updated_by`,`sys_class_path`,`sys_created_on`,`sys_domain`,`sys_created_by`,`a_num_10`,`a_bln_2`,`sys_mod_count`,`a_bln_1`,`monitor`,`sys_domain_path`,`a_bln_3`,`cost_cc`,`install_status`,`name`,`attested`,`unverified`,`correlation_id`,`fault_count`,`a_int_1`) VALUES('1.0',0,1,'2021-05-14 20:23:00',0,'cmdb_ci_business_capability','281badbe2f4870108bea56f62799b687','admin','/!!/#+','2021-05-14 20:23:00','global','admin',1,1,0,1,0,'/',1,'USD',1,'Develop Vision and Strategy',0,0,'1.0',0,0),INSERT INTO cmdb$par1 (`operational_status`,`sys_updated_on`,`sys_class_name`,`sys_id`,`sys_updated_by`,`sys_class_path`,`sys_created_on`,`sys_domain`,`sys_created_by`,`sys_mod_count`,`sys_domain_path`,`install_status`,`name`) VALUES(1,'2021-05-14 20:23:00','cmdb_ci_business_capability','281badbe2f4870108bea56f62799b687','admin','/!!/#+','2021-05-14 20:23:00','global','admin',0,'/',1,'Develop Vision and Strategy')
java.sql.BatchUpdateException: (conn=6059) Duplicate entry '1.00' for key 'a_num_10'
: java.sql.SQLException: java.sql.BatchUpdateException: (conn=6059) Duplicate entry '1.00' for key 'a_num_10': com.glide.db.StatementBatcher.getSQLException(StatementBatcher.java:643)
com.glide.db.StatementBatcher.commitBatch(StatementBatcher.java:595)
com.glide.db.StatementBatcher.commitAllOrNothing(StatementBatcher.java:469)
com.glide.db.DBCompositeAction.executeAsBatch(DBCompositeAction.java:228)
com.glide.db.DBCompositeAction.executeChunk(DBCompositeAction.java:171)
com.glide.db.DBCompositeAction.executeAsResultSet0(DBCompositeAction.java:108)
com.glide.db.DBAction.executeAndReturnTable(DBAction.java:267)
com.glide.db.DBAction.executeNormal(DBAction.java:256)
com.glide.db.DBAction.executeAndReturnException(DBAction.java:210)
com.glide.script.GlideRecordITable.insert(GlideRecordITable.java:158)
com.glide.script.GlideRecord.insert(GlideRecord.java:4971)
com.glide.script.GlideRecord.insert(GlideRecord.java:4881)
com.glide.script.GlideRecord.jsFunction_insert(GlideRecord.java:5425)
sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2609)
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
org.mozilla.javascript.gen._refname__4026._c_createCapability_1(&amp;lt;refname&amp;gt;:68)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2678)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2617)
org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
org.mozilla.javascript.gen._refname__4026._c_script_0(&amp;lt;refname&amp;gt;:38)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3459)
org.mozilla.javascript.gen._refname__4026.call(&amp;lt;refname&amp;gt;)
org.mozilla.javascript.gen._refname__4026.exec(&amp;lt;refname&amp;gt;)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73)
com.glide.script.Evaluator.evaluateString(Evaluator.java:96)
com.glide.update.UpdateManager2.testFixScript(UpdateManager2.java:750)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.runFixScript(ScriptFixXMLHttpProcessor.java:173)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.evaluateScript(ScriptFixXMLHttpProcessor.java:151)
com.snc.apps.ScriptFixXMLHttpProcessor$ScriptFixWorker.startWork(ScriptFixXMLHttpProcessor.java:126)
com.glide.worker.AbstractProgressWorker.startAndWait(AbstractProgressWorker.java:126)
com.glide.worker.ProgressWorker.startAndWait(ProgressWorker.java:52)
com.glide.worker.AbstractProgressWorker.start(AbstractProgressWorker.java:101)
com.snc.apps.ScriptFixXMLHttpProcessor.process(ScriptFixXMLHttpProcessor.java:87)
com.glide.processors.XMLHttpProcessor.processJavaAJAX(XMLHttpProcessor.java:168)
com.glide.processors.XMLHttpProcessor.process(XMLHttpProcessor.java:121)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:576)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:264)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:181)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:169)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:44)
com.glide.sys.Transaction.run(Transaction.java:2228)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

*** Script: [APQC IMPORT] APQC Capability Import complete, 1.0 loaded 
[0:00:00.167] Total Time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do i need to inactive any Business rules or i think some of Business Capability have the same name like "Develop Vision and Strategy" was this causing the issue to run the scirpt ?&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 20:28:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004560#M104</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-14T20:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004561#M105</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;this is not a business rule issue.&amp;nbsp; &amp;nbsp;It is complaining about a duplicate entry in a key field (a field that does not allow duplicates) named a_num_10.&amp;nbsp; Do you already have records in the cmdb_ci_business_capability table?&amp;nbsp; If so, delete them all before running the script.&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 May 2021 13:49:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004561#M105</guid>
      <dc:creator>mcastoe</dc:creator>
      <dc:date>2021-05-17T13:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004562#M106</link>
      <description>&lt;P&gt;Hi &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="1b31daa5db981fc09c9ffb651f96192a"&gt;@macastoe&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so very much for your help, i think i am good and when i delete in my PDI reimport the data i can see all are perfectly working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last question before i mark the response as correct, sorry for bearing me please do for one last time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if we already having records on Business capability table, which are not available in sheet then we can do this integration ? is there a way we can import all the records without deleting existing records in the table ?&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 17:43:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004562#M106</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-17T17:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004563#M107</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;so, in order to be able to use this import technique where there are already records you will have to query the cmdb_ci_business_capability&amp;nbsp;table and insure that your new capability has a unique correlation id, order and hierarchy id values.&amp;nbsp; If it does not, you either skip that record or you create a new unique value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mark&lt;/P&gt;
&lt;DIV id="mstr_highlight_precard" style="position: absolute; left: 0px; top: 0px;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 May 2021 19:05:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004563#M107</guid>
      <dc:creator>mcastoe</dc:creator>
      <dc:date>2021-05-17T19:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on importing Business Capability</title>
      <link>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004564#M108</link>
      <description>&lt;P&gt;Awesome, i think i can do that. Let me try to rephrase the code shared by you and update you accordingly&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 19:22:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/enterprise-architecture-forum/need-help-on-importing-business-capability/m-p/1004564#M108</guid>
      <dc:creator>shaik_irfan</dc:creator>
      <dc:date>2021-05-17T19:22:33Z</dc:date>
    </item>
  </channel>
</rss>

