+ Start a Discussion
Akshay ShrivastavaAkshay Shrivastava 

Object "A” => Master Object “B" => Detail Lookup Relationship We have to create a Custom field on “A”, which will show the total number of its “B” records. We can not change the relationship type of objects.

THROUGH CODING
Best Answer chosen by Akshay Shrivastava
ShirishaShirisha (Salesforce Developers) 
Hi Akshay,

Greetings!

We can call that field as Rollup Summary field and please refer the sample code in the below blog to create using Apex trigger:

https://www.biswajeetsamal.com/blog/custom-rollup-summary-field-using-apex-trigger/

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri