<?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: Get row count of related records in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682193#M253972</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I have a certificate task form, in this the business services(cmdb_ci_services)is the related list record.i have a field on the certificate task form as test. i want to populate this field, for that i want to count all the service record in business service related list.&lt;/P&gt;
&lt;P&gt;for eg:- for each task created&amp;nbsp;there are 2,3 services are there in the related list record. this i have to calculate and populate in test field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Aug 2020 12:04:07 GMT</pubDate>
    <dc:creator>Priya75</dc:creator>
    <dc:date>2020-08-14T12:04:07Z</dc:date>
    <item>
      <title>Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682188#M253967</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a field on the form as test. i want to populate this field on the basis of a related list, so i have a related list of business service which shows the records from cbdb_ci_service tables.i want to count of services related to that particular task and update that field.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:30:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682188#M253967</guid>
      <dc:creator>Priya75</dc:creator>
      <dc:date>2020-08-14T11:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682189#M253968</link>
      <description>&lt;P&gt;Hi Priya,&lt;/P&gt;
&lt;P&gt;When you want to populate that? when any new record gets added in related list?&lt;/P&gt;
&lt;P&gt;if yes then you would require BR on that related list table to increment or decrement the count based on insert or delete&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;ankur&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:51:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682189#M253968</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-08-14T11:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682190#M253969</link>
      <description>&lt;P&gt;No, when a task is created or updated and a business service is added to that task.i can't have run a business rule on cmdb_ci_service table.i want that count from task table and need to update the field .could you provide some scripting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:55:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682190#M253969</guid>
      <dc:creator>Priya75</dc:creator>
      <dc:date>2020-08-14T11:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682191#M253970</link>
      <description>&lt;P&gt;Have the field as a calculated field maybe? and query your respective table and get the rowcount.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;var categoryCount = 0;&lt;BR /&gt;var gr = new GlideAggregate('your table');&lt;BR /&gt;gr.addQuery(your query);&lt;BR /&gt;gr.addAggregate("COUNT");&lt;BR /&gt;gr.query();&lt;BR /&gt;while(gr.next()) {&lt;BR /&gt;categoryCount = gr.getAggregate("COUNT");&lt;BR /&gt;}&lt;BR /&gt;return categoryCount;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Please Mark as &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct if this solves your issue and also mark ???? Helpful if it helps resolve your problem.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Saji&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:56:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682191#M253970</guid>
      <dc:creator>Sajilal</dc:creator>
      <dc:date>2020-08-14T11:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682192#M253971</link>
      <description>&lt;P&gt;Hello Priya,&lt;/P&gt;
&lt;P&gt;By what I understood from your requirement, apart from the 'test' field, you have a reference field 'Business Service' on the from that fetches data from cmdb_ci_service table. Now my question is: is the data being retrieved in the reference field dynamic? what is the condition?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your statement "i want to count of services related to that particular task", what task are we talking about?&lt;/P&gt;
&lt;P&gt;Kindly clarify.&lt;/P&gt;
&lt;P&gt;Counting the number of services can be done easily via script once we know the condition that&amp;nbsp;filters data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:58:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682192#M253971</guid>
      <dc:creator>Servicenow Use4</dc:creator>
      <dc:date>2020-08-14T11:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682193#M253972</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I have a certificate task form, in this the business services(cmdb_ci_services)is the related list record.i have a field on the certificate task form as test. i want to populate this field, for that i want to count all the service record in business service related list.&lt;/P&gt;
&lt;P&gt;for eg:- for each task created&amp;nbsp;there are 2,3 services are there in the related list record. this i have to calculate and populate in test field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:04:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682193#M253972</guid>
      <dc:creator>Priya75</dc:creator>
      <dc:date>2020-08-14T12:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682194#M253973</link>
      <description>&lt;P&gt;Hi Priya,&lt;/P&gt;
&lt;P&gt;So you would require before update BR on the current table.&lt;/P&gt;
&lt;P&gt;Sample script below&lt;/P&gt;
&lt;P&gt;var gr = new GlideRecord('&lt;SPAN class="ng-scope"&gt;cmdb_ci_service&lt;/SPAN&gt;');&lt;/P&gt;
&lt;P&gt;gr.addQuery('task', current.sys_id);&lt;/P&gt;
&lt;P&gt;gr.query();&lt;/P&gt;
&lt;P&gt;current.&amp;lt;fieldName&amp;gt; = gr.getRowCount();&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:11:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682194#M253973</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-08-14T12:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682195#M253974</link>
      <description>&lt;P&gt;i want it on cert_task table. when a related service is added or updated .&lt;/P&gt;
&lt;P&gt;what i have to mention in current.field name.. when it is a table record.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a certificate task form, in this the business services(cmdb_ci_services)is the related list record.i have a field on the certificate task form as test. i want to populate this field, for that i want to count all the service record in business service related list.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:16:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682195#M253974</guid>
      <dc:creator>Priya75</dc:creator>
      <dc:date>2020-08-14T12:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682196#M253975</link>
      <description>&lt;P&gt;Hi Priya,&lt;/P&gt;
&lt;P&gt;So since you want field to be updated based on service is added/updated or deleted then BR should be on cmdb_ci_service table&lt;/P&gt;
&lt;P&gt;There must be some field on cmdb_ci_service which holds certificate information&lt;/P&gt;
&lt;P&gt;query with that field and then get the count&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:23:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682196#M253975</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-08-14T12:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682197#M253976</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;so in cmdb_ci_service table.. the certification is the related list. so we query same way like we query a table?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:26:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682197#M253976</guid>
      <dc:creator>Priya75</dc:creator>
      <dc:date>2020-08-14T12:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682198#M253977</link>
      <description>&lt;P&gt;Hi Priya,&lt;/P&gt;
&lt;P&gt;Hope you are doing good.&lt;BR /&gt;&lt;BR /&gt;Let me know if that answered your question.&lt;BR /&gt;&lt;BR /&gt;If so, please mark appropriate response as correct &amp;amp; helpful so that this thread can be closed and others can be benefited by this.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 12:41:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682198#M253977</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-08-21T12:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get row count of related records</title>
      <link>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682199#M253978</link>
      <description>&lt;P&gt;Hi Priya,&lt;/P&gt;
&lt;P&gt;Hope you are doing good.&lt;BR /&gt;&lt;BR /&gt;Let me know if that answered your question.&lt;BR /&gt;&lt;BR /&gt;If so, please mark appropriate response as correct &amp;amp; helpful so that this thread can be closed and others can be benefited by this.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Aug 2020 11:37:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/get-row-count-of-related-records/m-p/682199#M253978</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-08-23T11:37:45Z</dc:date>
    </item>
  </channel>
</rss>

