+ Start a Discussion

Trigger to create or update records in child custom object

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) 

Check the code sample shared in the thread on the link below:

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