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
sfdc_beginner7sfdc_beginner7 

Is there any way to find max of number field from child object having look up relationship

I have a custom child object "Child__c" which is having a "Leg__c" field of type number(2,0), "Child__c" is related to parent object "Parent__c" through look up relationship.
Ex : "Parent__c" is having 6 "Child__c" with following leg
Child001    1
Child002    6
Child003    5
Child004    4
Child005    7
Child006    3
There is a field "Max_Leg__c" on "parent__c" .I need to find the max value of "Leg__c" from child object so that means my  
Max_Leg__c should be 7 on parent object.
Can we achieve it using configuration?
 
PawanKumarPawanKumar
you create a master-detail relationship between object and use Rollup summary fields. This is the out of the box solutions.

Please look at here.
https://www.jitendrazaa.com/blog/salesforce/roll-up-summary-fields-in-salesforce/

Regards,
Pawan Kumar
Steven NsubugaSteven Nsubuga
It is not possible with just configuration, unless you convert the look up to a master detail, and then use a roll up summary field.
sfdc_beginner7sfdc_beginner7
Thanks Pawan & Steven for quick response
I can't change the relationship between these 2 objects.
PawanKumarPawanKumar
If you do not want to change the relationship then you have to go with trigger or app exchange solution(the free one). Please refer below one which can easily solve your problem.

https://github.com/afawcett/declarative-lookup-rollup-summaries

https://github.com/abhinavguptas/Salesforce-Lookup-Rollup-Summaries

Regards,
Pawan Kumar