<?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 Populate CMDB CIs based on the Selection of Service Field in CMDB forum</title>
    <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208069#M14881</link>
    <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a requirement for populating the CIs based on the Service selection.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example -&lt;/P&gt;&lt;P&gt;If user selects "Service 1", so as per the configuration done in cmdb relationship table (i.e. Service 1 is parent of all the CIs), the specific CIs list should be populated in the CI field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me what should be my approach or best practice to take this ahead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 17 Mar 2025 06:13:37 GMT</pubDate>
    <dc:creator>Suraj Yadav1</dc:creator>
    <dc:date>2025-03-17T06:13:37Z</dc:date>
    <item>
      <title>Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208069#M14881</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a requirement for populating the CIs based on the Service selection.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example -&lt;/P&gt;&lt;P&gt;If user selects "Service 1", so as per the configuration done in cmdb relationship table (i.e. Service 1 is parent of all the CIs), the specific CIs list should be populated in the CI field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me what should be my approach or best practice to take this ahead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 06:13:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208069#M14881</guid>
      <dc:creator>Suraj Yadav1</dc:creator>
      <dc:date>2025-03-17T06:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208080#M14883</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/426569"&gt;@Suraj Yadav1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, it can be done, but you need to modify the OOTB configuration in this case. OOTB a CI is dependent on company&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AGLearnNGrow_0-1742192566708.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/427375iC8B87EABF76CE13B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AGLearnNGrow_0-1742192566708.png" alt="AGLearnNGrow_0-1742192566708.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where as you need it should depend on Service and it should depend on Service Offering So hirecacy is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Service - Service Offering - CI&amp;nbsp; , you can build a logic for this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenow.com/community/itsm-forum/auto-populate-configuration-item-field-based-on-service-offering/td-p/2693297" target="_blank"&gt;https://www.servicenow.com/community/itsm-forum/auto-populate-configuration-item-field-based-on-service-offering/td-p/2693297&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.servicenow.com/community/developer-forum/populate-business-service-based-on-ci-selection/m-p/2200730" target="_blank"&gt;https://www.servicenow.com/community/developer-forum/populate-business-service-based-on-ci-selection/m-p/2200730&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 06:25:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208080#M14883</guid>
      <dc:creator>Dr Atul G- LNG</dc:creator>
      <dc:date>2025-03-17T06:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208086#M14884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/426569"&gt;@Suraj Yadav1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like there's some confusion between populating values and lookup display. Since multiple CIs are related to a Service in the CMDB relationship table, how do you determine which specific CI should be populated into the CI field?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you clarify if you're looking to automatically set a CI based on the selected Service or simply filter the CI lookup list to show only related CIs?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Tai Vu&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 06:28:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208086#M14884</guid>
      <dc:creator>Tai Vu</dc:creator>
      <dc:date>2025-03-17T06:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208137#M14886</link>
      <description>&lt;P&gt;Hi Tai Vu san,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you are doing well,&lt;BR /&gt;I have created a relationship in CI Relationship table(cmdb_rel_ci), where with the help of parent &amp;amp; child field, we are defining the Service and CI field.&lt;BR /&gt;For Example :&amp;nbsp;&lt;BR /&gt;In Relation ship table, "Service 1" is treated as a Parent and Child will be CIs.&lt;BR /&gt;1. "Service 1" = Parent, CIs1 = Child&lt;BR /&gt;2.&amp;nbsp; "Service 1" = Parent, CIs2 = Child&lt;BR /&gt;3.&amp;nbsp; "Service 1" = Parent, CIs3 = Child&lt;BR /&gt;&lt;BR /&gt;With the help of this relationship I have defined, I want to populate the CI based on the Service field selection on the Incident, Problem or Change form.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 07:39:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208137#M14886</guid>
      <dc:creator>Suraj Yadav1</dc:creator>
      <dc:date>2025-03-17T07:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208151#M14888</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/426569"&gt;@Suraj Yadav1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="45" data-end="160"&gt;The relationship is fine; the issue isn’t with the relationship itself. We had a similar issue on the client side.&lt;/P&gt;
&lt;P data-start="162" data-end="192"&gt;Possible and complex solution:&lt;/P&gt;
&lt;OL data-start="194" data-end="524"&gt;
&lt;LI data-start="194" data-end="221"&gt;Select the Service / SO.&lt;/LI&gt;
&lt;LI data-start="222" data-end="263"&gt;BR – Which runs on the CMDB_REL table.&lt;/LI&gt;
&lt;LI data-start="264" data-end="305"&gt;Capture all dependent CIs in an array.&lt;/LI&gt;
&lt;LI data-start="306" data-end="345"&gt;If there’s only one CI, populate it.&lt;/LI&gt;
&lt;LI data-start="346" data-end="524"&gt;If there are multiple CIs, we cannot populate the value automatically. The user will need to select manually, but only the CIs that are dependent on the parent will be shown.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 17 Mar 2025 07:45:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208151#M14888</guid>
      <dc:creator>Dr Atul G- LNG</dc:creator>
      <dc:date>2025-03-17T07:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Populate CMDB CIs based on the Selection of Service Field</title>
      <link>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208308#M14891</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/426569"&gt;@Suraj Yadav1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I think what you're looking for is Reference Qualifier instead of auto-population. You can also consider autofill if there's only one associated CI as Atul suggested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your case, if it's just a one-level relationship, we can easily query the cmdb_rel_ci table to retrieve the CIs related to the selected Service, then call the function in the Reference Qualifier of the CI field. Sample:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;getCIByService: function(service_id){
	var cis = [];
	var grRel = new GlideRecord('cmdb_rel_ci');
	grRel.addQuery('parent', service_id);
	grRel.query();
	while(grRel.next()){
		cis.push(grRel.getValue('child'));
	}
	if(cis.length == 0){
		return 'sys_id=-1'; //empty list
	}else{
		return 'sys_idIN' + cis.join(',');
	}
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, consider a scenario where multi-level relationship exists =&amp;gt; CI1, CI2, or CI3 have their own relationships with other CIs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may want to retrieve all related CIs recursively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Tai Vu&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 10:13:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/cmdb-forum/populate-cmdb-cis-based-on-the-selection-of-service-field/m-p/3208308#M14891</guid>
      <dc:creator>Tai Vu</dc:creator>
      <dc:date>2025-03-17T10:13:43Z</dc:date>
    </item>
  </channel>
</rss>

