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
LAKSHMAIAH CHAGANTILAKSHMAIAH CHAGANTI 

Trigger to create or update records in child custom object

Hi 
I am new to trigger coding, here is my scenario 
1.We have Account object which is having master-detail relation with custom object Aggregator__c object(fields in Aggregator__c are Aggregator_id__c, Aggregator_Name__c, Description__c, Amount__c). This Aggretor object records are showing in related list in the account.
2. My requirement is whenever there is a new record for Aggregator it must create a new record if it is completely new record or it must update the existing record if the data is coming for already existing records based Aggregator_id__c which is a unique field(number).

Thanks in Advance.
SonamSonam (Salesforce Developers) 
Hi,

Check the code sample shared in the thread on the link below:
http://salesforce.stackexchange.com/questions/36400/how-to-check-and-update-existing-contact-using-apex

This has a similar requirement so you should be able to use the same format to implement your requirement.