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

cross-object formula for email alert . . .

Hi. Is it possible to use a cross-object formula to bring over an email from a parent object to a child object so that I can use that email in an email alert?

Thanks for any tips.
No, there is no formula that you can use that would access emails (unless you're using some sort of custom emails object).  You may be able to do that with an Apex trigger though depending on the circumstances.
Well, it's a fairly simple use case.

When a new child object record is created, I want an email to be sent to whatever email is on the related parent object record.

And I want the fields from the child object to be included in that email.

Think an Apex trigger would work for that?
Ah.  You may not need an Apex trigger for that then.  Instead, put a custom Email field on the child object, and set its default value as the parent's email address that you want the notifications.  Then you should be able to make a simple Workflow Email Alert that sends an email to that address when the object is actually created (using a template that includes some fields from that object).
If it's that simple, that would be great. The email on the parent object will vary, obviously, from record to record.

How do you set that default value?
It turns out you can't reference the email from the parent object using a custom email on the child object.

The default value formula won't "look up" to the parent object (it will for formula fields, but not other custom fields).

So, the solution was to create a workflow rule that does it instead. The rule sets the email field on the child object at null (blank) so that when there's no email on the child object, which there isn't to begin with, it triggers an action.

Then the action uses the following formula to reference the email field in the parent object and place it in the email field in the child object:


Interestingly, "Site_ID_Number" is the name of the parent object's Name field not the name of the object itself. It wouldn't when the object name was used. So that was a little twist to getting it working right.

And then there is a second action on this workflow rule that uses the email that is now on the child object to send an email (i.e., "Email Alert").

Works great. Thanks for pointing me in the right direction.
World TechWorld Tech

I am trying to mimick what you have done here. What does your If/Then statement look like? I need the custom object to reference the case that the record is associated to. When a new record on my custom object is created it needs send an email to the project manager listed on the case. 


Thanks for any help!



Message Edited by World Tech on 06-30-2009 09:08 AM
Ken KoellnerKen Koellner

I might try that workflow option to set a child email field.  Problem with that though is it won't work if the parent can change or the parent's email address can change.


Allow a formula field of type "email" would fix all this.  Referencing information is always a better solution that copying it around.  I made up the saying "if you write something down in more than one place, eventually it will be wrong in at least one place."


See his Idea --