I have a standard object that needs to have an amount rolled up from a custom object that is in a lookup relationship. To achieve this , Can I write a trigger on the child object ?
Yes you can certainly write the trigger on the child object in order to get the amount rolled up. In this you can use the AggregateResult Datatype in order to roll up the amount.
List<AggreagateResult> agList = [Select SUM(Amount),ParentObjectId from Custom_Object__c GROUP by ParentObjectId];
However I suggest you to go for the Roll Up Summary field to achieve the desired functionality.
Yes you can certainly write the trigger on the child object in order to get the amount rolled up. In this you can use the AggregateResult Datatype in order to roll up the amount.
However I suggest you to go for the Roll Up Summary field to achieve the desired functionality.
Hope this helps.
Thank you.