So here's my issue. I have an object called Products, and a Object called Sample. My requirement is that when there is a new sample generated it needs to look into my product object and automatically populate the Sample with the Application Engineer responsible for it. So lets make it a more general question.

I can't find the relationship between the two objects, I understand id is common but it doesn't appear that there is a link there. Does anyone have a suggestion?


I was able to locate one field that is related, the product name. Although this is loose and don't know if it is 1 to 1 per the product.

3 Answers 3


There should be a either a lookup or master-detail field on Sample to Product. See https://www.salesforce.com/us/developer/docs/api/Content/relationships_among_objects.htm for more details on the differences. If a lookup or master-detail field on the sample object does not exist relating it to Product, one would need to be created.

If it truly needs to be a 1-1 relationship, please see this related question for details on ways to do that: How to create a one-to-one relation between two objects?

Once you have this relationship established, meeting the requirement should be as easy as creating a formula field on Sample that uses a cross-object formula to populate the Application Engineer on the Sample. It would look something like: Name_Of_Relationship_Field__r.Application_Engineer__c

More details on cross object formulas and how to build them: http://help.salesforce.com/HTViewHelpDoc?id=customize_cross_object.htm&language=en_US

  • aggh :( never even thought to just do a cross object formula, and I'm pretty much done with my trigger. Oh well lesson learned, thanks
    – EricSSH
    Commented Mar 25, 2014 at 18:46
  • Hey could you possibly be a little more specific to what my formula would look like?
    – EricSSH
    Commented Mar 25, 2014 at 21:07
  • 1
    I think the easiest way to do it is to do it through the Advanced Formula tab without me knowing your exact field names. If you click on insert field, it should come up with a list of fields on the Sample object. Navigate to which ever field is the lookup/master-detail relationship to Product and has a >. That should populate the next window over with the fields from that object. Then just go to your Application Engineer field in that list, and click on insert field. It should build the formula for you. Commented Mar 25, 2014 at 21:12
  • 1
    Otherwise, if your API Name for the lookup is Product__c, and the API name for Application Engineer is Application_Engineer__c, then the formula would be Product__r.Application_Engineer__c Commented Mar 25, 2014 at 21:13
  • I get what your saying.. I'm getting snagged on that they want it to be a Lookup list, and if they don't input anything it will be auto populated.. :( This has to be a trigger doesn't it. Trigger.IsAfter/IsBefore
    – EricSSH
    Commented Mar 25, 2014 at 21:30

If I'm developing in the Eclipse IDE, I locate relationship names by clicking the salesforce.schema file in the Project Navigator, then either:

  1. Locate parent object and then explode the Child Relationships
  2. Locate the child object and then find the lookup field and explode that to get Foreign Key

You can also use SFDC Workbench | Info | standard and Custom Objects from the browser and get the same as above


The surefire way to find the name of the relationship field is to generate, download and inspect the Enterprise Soap API Wsdl.

There will be complex entities for objects, and sooner or later one of the objects you know are related there will be a __r field. the __r indicates a relationship field, and the wsdl is great about showing you the naming.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .