I created a junction object called Sponsorship__c
and have a many-to-many relationship. It is related to Contact through a master-detail relationship and I have another custom object called Sponsored_Child__c
which also has a relationship with Sponsorship__c
.
What I need to do is create a trigger that updates a Contact field once a new Sponsorship is been created or updated. That field is Child_Names__c
and once a Sponsorship is created, the first name(First_Name__c
of Sponsored_Child__c
) of the Child is concatenated to the field Child_Names__c
of Contact.
Best Answer
One of the things I like to do is add formula fields to my Junction objects to simplify things. So the first step would be to make a field on Sponsorship__c; I'll call it: Sponsored_Child_Name__c.
Formula: Sponsored_Child__c.First_Name__c
Another very important thing to keep in mind is bulkification:
Pseudo Code
That should get you close.