function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TTATTA 

COUNT/TOTAL of the child records

Hi all,

I have got two objects called clubs and registraions. I can register delegates to different clubs. On the club object I have got a field called spaces_booked. What I would like to do is to display number of delegates who have booked for that particular club.

 

Is there a way to achieve that? I can't seem to find the COUNT function on the salesforce.

 

Help please.

 

Registraions Object

Registered 

- Mr Dole

- Mr Smith 

 

Club Object 

Spaces_Booked

- 2

------------------- 

Regards, 

dev_jhdev_jh

2 Options:

 

1 - If you link them as child-parent, you can use Rollup Summary fields to count. Definetely the easier.

2 - Alternatively you will have to do this via triggers.

 

Hope that helped,

 

J

TTATTA

Hi there,

 

Thanks for your reply. I tried converting that look up filed (Club) to a master detail type but keep getting the following error message:

 

Cannot Create Master-Detail Relationship

You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail. 

 

 

 

I also deleted all the records on both club and registration objects but still getting the error message.

 

Thanks for your reply anyway.


Regards, 

 

shillyershillyer

I deleted all of the records of the Custom Object that has the Lookup field, and then made the switch to Master-Detail. If that doesn't work, why not delete the Lookup field and create a new Master-Detail.

 

Hope that helps,

Sati

dev_jhdev_jh

Hi,

 

Probably the problem lies in the deleted records still being in the Recycle Bin. Empty SF´s recycle bin and try again. It should work. Good luck,

 

J