How to calculate the count from the related list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 03:09 AM
Hi All,
How to get the number present in the related list into a particular string field?
What I mean is "(say) for example, we are having the total count (number) of the related list as '10', that value should be copied to the String field".
Please do let me know how to achieve it.
Any Ideas?
Thanks & Regards,
Ram Prakash
- Labels:
-
Enterprise Asset Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 03:28 AM
HI Ram,
Are you taking about records in related list or Number of Related list on the form
Thank you,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 04:28 AM
Hi Ashutosh,
Yeah I am saying about the "number of records" in the related list.
Thanks & Regards,
Ram Prakash

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 04:45 AM
Hi Ram,
Excellent!
Then this is easy. Which Related list are you using. I am assuming that it has a parent child relationship
ex:
var count =new GlideAggregate('incident');
count.addQuery('parent',current.sys_id);
count.addAggregate('COUNT');
count.query();
var incidents =0;
if(count.next())
{
incidents = count.getAggregate('COUNT');
count.string_field_name = incidents.toString();
count.update();
}
Thank you,
Ashutosh Munot
Please Hit Correct, Helpful or like,if you are satisfied with this response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 05:18 AM
Hi Ashutosh,
Yeah I am using "User Entitlements" related list which is in the table "Software License".
I checked in "System Definition -> Relationships" but I couldn't locate that.
May I know how to check it? where to check it?
Thanks & Regards,
Ram Prakash