Pull Data from Parent / Related Records

If you're looking for a way to pull data from a parent or related record, you'll have to use "subfields" inside your template.  Here's an example for pulling Account fields into a document being generated from a Contact record.

Inside our template, we're going to use merge fields like {$Account.Name}, {$Account.Favorite_Color__c}, etc.

- "Account" is the name of our merge field.  You can name this anything you'd like.

- "Favorite_Color__c" is the API Field Name of the field that you want to use.

 

Once you update your template in WebMerge, go to your WebMerge Mapping inside Salesforce, and we're going to look for our merge field (we used "Account").  For this merge field, we're going to match it up to the "Account: (Full Object)" option in the Salesforce Field dropdown:

salesforce_full_object.png

 

When you select the (Full Object) option, that will send over all the fields for that object to your document as an array.  Then inside the document you can reference the individual fields with the subfields like {$Account.Phone} and {$Account.Car_Number__c}.

If you're not sure which subfields to use in your document, you can turn on Debug Mode to see the fields that are being sent over from Salesforce.  In this example, here's what our Debug Mode data looked like on the Overview tab of our document:

salesforce_full_object_data.png

Have more questions? Submit a request

4 Comments

  • Avatar
    Richard Smith

    Hi,

    I'm trying to use this dot notation to access Account fields, for a document based on a custom object - Equipment.

    The merge fields in the document are {$Account} for the full object, and {$Account.Name} to select the Account name field

    The Account: (Full Object) field shows the Account Name
    The Account: Account Name field shows only the first letter of the account name.

    What am I doing wrong ?

  • Avatar
    Jeremy Clarke

    Hi Richard,

    Since you're using {$Account.Name} in your document, you'll see "Account" listed as the merge field in your WebMerge Mapping inside Salesforce. You'll want to match that field up with the "Account: (Full Object)" option in the Salesforce Field dropdown so that SF sends over all the fields for the Account record.

    Then, you can also use fields like {$Account.Phone}, {$Account.Favorite_Color__c}, etc to display other fields in your document.

    You only want to use the "Account: Account Name" mapping if you have a single field in your document (without the dot) like this: {$AccountName}

    Thanks!

  • Avatar
    Christian Schulenburg

    Hi Jeremy! Is this something new? I've mapped all fields in SF Sandbox field by field. And now in production when trying to map via a lookup field it only gives me the option of Object: Full Object. Is the field to field solution obsolete or how can I solve this? I would like to map field by field directly, not like the solution you describe above. Thanks!

  • Avatar
    Jeremy Clarke

    Hi Christian,

    This is not new, but in newer versions of our package we limit the number of relationship fields that we show (due to SF limitations). So if you have a lot of relationships, then we only show the (Full Object) option.

    Sorry for any inconvenience but it sounds like you'll have to use the full object route :(

Please sign in to leave a comment.
Powered by Zendesk