+ Start a Discussion
abcutterabcutter 

Can I pull data down from an Account record to its Contact records?

How can I pass the value of a field from the Account record down to the Contact records for that account? I have a field on the account level with a status that I want to view on the contact records associated with that account. I don't want users to have to complete the field again for every contact - I just want it pulled down from the Account level. Is this possible?
 
Thanks for the help!
 
Best Answer chosen by Admin (Salesforce Developers) 
abcutterabcutter

I really just want to show the Account field on the Contact screen but I also want to use it for views so I can filter a custom view under Contacts with this status field. If I display the field on the Contact screen, will it allow me to use it in custom views?

Thanks for your help!

All Answers

mattdarnoldmattdarnold
You could use an Apex trigger to add this information from the Account to the Contact record before insert. This would get you what you need, but also would allow the user the flexibility to change the values of this field in subsequent updates.

Alternatively, you could use a vlookup formula field that pulls your data from the Account, assuming this isn't a standard field on the Contact object. This function is similar to Excel's vlookup and follows this syntax: VLOOKUP(field_to_return, field_on_lookup_object,
lookup_value).

Let me know if that gets you what you need.

-- Matt

rockchick322004rockchick322004
VLOOKUP() only works against custom objects and only in validation rules right now, so that won't help.  :-(

The solution today for Enterprise Edition and above customers is to use Workflow Field Updates to copy the data.  That is less than ideal because if the value changes on the account you will not see that change on the contact.  In the next release (Summer '08) we will support this in formula fields -- we will allow the formula fields to pull in merge fields from the parent record (e.g., you can create a formula field on contact that references Account.Status).
jrotensteinjrotenstein
Do you simply want to show the Account field on the Contact screen (which is easy), or do you want to copy it down to the Contact record (harder)?

If you want to copy, what do you want to happen when the field changes on the Account?
abcutterabcutter

I really just want to show the Account field on the Contact screen but I also want to use it for views so I can filter a custom view under Contacts with this status field. If I display the field on the Contact screen, will it allow me to use it in custom views?

Thanks for your help!

This was selected as the best answer
Rob@NRPRob@NRP
I would be interested in this as well, just displaying the value on the contact.  For me it would be a Relationship Manager that is a User Lookup on the Account Level that I would want passed to the Contact and ultimately the Opportunity as well as any other child record of that Account.
jrotensteinjrotenstein
You can display fields from related records by using an S-Control.

For example, to display Account information on a Contact record, create an S-control with codes to the fields you want. For example:

Code:
{!Account.Name}

 This will display the Account field on the Contact! It seems to work for related records. You'll have to experiment to see if it will display on all your desired objects.

JudyJudy
i tried using your method but the field is blank ..
abcutterabcutter

Hi John,

The s-control worked and it is pulling the status data from the account record - thanks! However, it's appearing on the page in a huge block instead of just an additional field. I want it to appear under Contact Detail in the contact record just as the other fields appear. Do I need to use HTML to control the display? I've watched some of the s-control videos and read the documents posted under help & training but everything I find is far more complicated than what I need to do. I haven't been able to find anything that explains how to make this simple s-control work properly.

Any additional help would be greatly appreciated!

jrotensteinjrotenstein

You can control the height of an S-control on the page.

Go to the page layout and double-click the S-Control (where it is showing up in the main layout area). You can then set the height. Something around 20 should be sufficient. You can also turn on the label.

If the font looks 'wrong', either insert some HTML or use the official Salesforce style sheets.

abcutterabcutter
Thanks for the help - I'll give it a shot...
abcutterabcutter

Hi John,

I made the changes you suggested and it's working properly for the most part. I'm still struggling with something in the html - I have the styles working so the field looks right on the page but the background color is only working where there is text. If the field is null, it's just showing a white "table cell" and if it there is data, the text behind the data is gray but the rest is white. Any thoughts?

More importantly, the reason I really wanted s-control was so I could create a new View that would allow me to use the status in this field to pull data. Essentially, we have status on an account level (client, prospect, etc.) and I want to be able to create a view of all contacts where status=X. The s-control field that I just created is not showing up in my criteria when I create a new view. Do you know if it's possible to do this or if there is another way?

Thanks!

Alexis

abcutterabcutter

I just got the html working so I'm all set with that. But if you can let me know if there is a way to pull the data from the new s-control field that I added to my contact screen into a new view that would be great.

Thanks!

Alexis

rockchick322004rockchick322004
Thanks, John, for helping out with the sControl solution.  It is very handy that sControls can display as if they are fields in the detail page.  abcutter, the downside is that the sControl only displays on the detail page, it is not a real field on the object, the way a formula field is.  If you can wait until Summer '08, this will be really easy to do!  For now, you will not be able to display this in the list unless you go the workflow field update route (assuming you have Enterprise Edition or above).

p.s.  sControls do support referencing some parent merge fields, as John found out, but that is only a side-effect of the fact that in some cases, the parent data is available at the time the sControl is loaded (i.e., it's a bug, not a feature!).  ;-)  In Summer '08, the sControl merge fields will not change (they wil still not be able to reliably reference parent fields), but the Formula Fields will be able to reference parent merge fields.  Summer '08 is just around the corner!


abcutterabcutter

mscotton - thanks for your response. sounds like this will have to wait for summer. will the summer '08 release allow you to pull s-controls into that list or will i need to reconfigure how i've pulled the status field into the contact record?

i'm intrigued about how i'd use workflow field updates to handle this right now. can you point me in the right direction?

rockchick322004rockchick322004
Sorry for the delay.  There is an example of how to do something similar (set a field on your record based on the value of a field in the parent record) in the online help & training.  Search on "Setting Default Opportunity Name" for that example.