+ Start a Discussion
jesslindyjesslindy 

Apex Trigger for displaying Child record info to a Parent record

Hello, I have a situation where I need to display information from a Child record to a Parent, which Formula Fields can't do, and the only thing I found is that a custom SControl can be made, but I know sControls are no longer supported an an Apex Trigger needs to be used instead....

Only problem is I have no idea what an Apex Trigger is or how to do this. Is it possible someone can help???

 

Here is what I'm looking to do:

-> Display values from two fields of a Contact's record - "Lead Source" picklist and "Addition Lead Sources" multi-picklist - as a text field in the contact's Account record. I'd like to include values from all Contacts associated with that Account in one field in the Account record, but only shows unique values once (no duplicate values).

For example....

(Contact 1) John Doe / (Account) Microsoft:
(Picklist) Lead Source = "Google"
(Multi-picklist) Additional Lead Source = "Webinar", "Email"

(Contact 2) Jane Smith / (Account) Microsoft:
(Picklist) Lead Source = "Referral"
(Multi-picklist) Additional Lead Source = "Google", "Email"

In Microsoft's Account record:
(Text Field) Lead Source: "Google, Webinar, Email, Referral"

 

 

If anyone could provide some guidence it would be extremely helpful! Thanks :)

DharmeshDharmesh

When do you want to update the account field, on update or create of account or on update of contact ?

jesslindyjesslindy

Good question, I guess it doesn't matter, but ultimately any time a Contact is updated I'd like it to reflect in the Account record.