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 Formstack Documents, go to your Formstack 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:



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:


Was this article helpful?
4 out of 8 found this helpful


  • 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 ?

  • 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}


  • 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!

  • 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 :(

  • Hi Jeremy. One more question on this topic. Would it also be possible to go an additional level deeper.
    For example: I'm creating a document based on my Opportunity object, it has a link to an Account (lookup). And that Account has a relation with a contact (also with a lookup) and I want to fetch a certain field from that Contact.
    I've tried doing: {$Account.AccountManager__r.FullName__c} but this doesn't work.
    The AccountManager__c (changed c into r for the relation) is the lookup relation field, and FullName__c the final field I want to merge into the document.
    But this doesn't work. Also tried debug mode, but it doesn't show me this additional relation.

  • Hi Hans,

    In the dropdown list of fields in your WebMerge Mapping, there should be an option like "Account: Contact" which is going to be the lookup on the account record. If you don't see that, you'll need to use an SOQL query to pull the data: https://support.webmerge.me/hc/en-us/articles/115005962103-Use-SOQL-Queries



Please sign in to leave a comment.