Embedding Salesforce fields into your Inkit template

You inject Salesforce data into the documents you generate through Inkit by embedding Salesforce fields into the template you will use to generate your documents and then setting Salesforce as the destination of the template.

To embed Salesforce data into your Inkit template and have the generated document go to Salesforce, do the following:

  1. Identify the names of the Salesforce fields that you want to embed.
  2. Embed the Salesforce fields into your document template.
  3. Make Salesforce the destination of your document template.

Identifying the names of the Salesforce fields that you want to embed

Before you can embed Salesforce data into your Inkit template, you need to identify the names of the Salesforce fields that you want to embed. You do this by editing a Salesforce object. In the following example, we will discover the fields available within a Sales Opportunity object:

  1. In Salesforce, click the App Launcher.

    In the Search apps and items... field, enter sales and click the Sales app.

  2. In the Sales page, click the Opportunities tab and click on an Opportunity Name.

  3. In the Opportunity page, click the settings gear and then click Edit Object.

  4. In the Object Manager page, select Fields & Relationships in the left sidebar. The field names will display under FIELD NAME.

Once you have found the Salesforce fields you want to embed into your document template, you next need to identify their Inkit naming convention. You determine this based on whether it's a simple field, a parent field or a child field.

Identifying a simple Salesforce field

A simple Salesforce field is one that doesn't refer to a parent object. In the following example, the field Close Date in an Opportunity object is a simple Salesforce field, as its DATA TYPE is neither Lookup([object]) or Master-Detail([object]).

You can identify the field by the FIELD NAME CloseDate in your template.

Identifying a parent Salesforce field

A parent Salesforce field refers to one that has a parent object, so it must be referenced to by this object. Parent Salesforce fields have a DATA TYPE of either Lookup([object]) or Master-Detail([object]) and are identified using the notation: Parent.Child. There are two types of parent Salesforce fields: standard and custom.

Standard parent Salesforce fields

Standard parent Salesforce fields refer to the fields that come standard in Salesforce. In the following example, the field Account Name in an Opportunity object refers to a DATA TYPE of Lookup(Account).

To find the FIELD NAME for Account Name, you must first view the Fields & Relationships page of the parent Account object. You do this by clicking on the Object Manager tab and selecting Account.

Then look for the field you want to embed.

To identify this field, you append the FIELD NAME to its object, so the field you use is Account.Name.

Custom parent Salesforce fields

Custom parent Salesforce fields refer to fields that have been added to Salesforce (fields appended with __c in the Salesforce interface.) In the following example, we have added a Guarantor object to an Opportunity object. In the Guarantor object, the field Opportunity refers to a DATA TYPE of Master-Detail(Opportunity).

To find the FIELD NAME for Opportunity Name, you must first view the Fields & Relationships page of the parent Opportunity object. You do this by clicking on the Object Manager tab and selecting Opportunity.

Then look for the field you want to embed.

To identify this field, you append the FIELD NAME to its object, replacing the __c part of the object with __r, so the field you use is Opportunity__r.Name.

Identifying a child Salesforce field

A child Salesforce field refers to a field that represents a collection of children of an object. There are two types of child Salesforce fields: standard and custom.

Standard child Salesforce fields

Standard child Salesforce fields refer to the fields that come standard in Salesforce. For example, the Opportunity object is a child of the Account object. To identify all Opportunities within an Account, the field you use is Opportunity.

Custom child Salesforce fields

Custom child Salesforce fields refer to fields that have been added to Salesforce (fields appended with __c in the Salesforce interface.) For example, we have added the Guarantor object as a child of the Opportunity object. To identify all Guarantors within an Opportunity, the field you use is Guarantor__r, replacing the __c part of the field with an __r.

Embedding the Salesforce fields into your document template

Once you've collected the set of Salesforce fields that you want to include in your Inkit template, the next step is to embed these into the template. To do this, either create or edit a template and add Salesforce fields to it.

For individual Salesforce fields, you embed them in your document between double curly brackets ({{}}). Using the examples from the previous section, if from an Opportunity object you want to include the Close Date, you would embed the following into your template:

{{CloseDate}}

If from an Opportunity object you want to include the Account Name, you would embed the following:

{{Account.Name}}

If from a Guarantor object you want to include the Opportunity Name, you would embed the following:

{{Opportunity__r.Name}}

For embedding a collection of child Salesforce fields, you need to iterate through the child field. Using the examples from the previous section, if from an Account object you want include all the Opportunity names associated with it, you would embed the following into your template:

{% for opportunity in Opportunity %}
   1. {{opportunity.Name}}
{% endfor %}

If from an Opportunity object you want to include all the Guarantor names associated with it, you would embed the following:

{% for guarantor in Guarantor__r %}
   1. {{guarantor.Name}}
{% endfor %}

Making Salesforce the destination of your document template

After you have embedded the Salesforce fields into your Inkit template, the final step is to set Salesforce as the destination of the template, by doing the following:

  1. Install the Salesforce app in the Inkit web app if you haven't already done so.

  2. In the Inkit web app, select Templates from the left sidebar and double-click on the template that you want to use.

  3. In the Destinations panel of the Edit Template page, click + Add.

  4. In the Add Destination dialog box, select Salesforce and click Continue.

  5. In the Salesforce Settings dialog box, select your Salesforce delivery method. If you want to send a link to the generated document to Salesforce, select Send Inkit Storage link. If you want to send the actual generated document to Salesforce, select Send file.

    You can also set expiration options of the generated document. To have documents expire after certain amount of time, turn the switch beside Expire Document after on and specify the Amount of Time and the Unit of time. You can choose from the following units:

    • Minutes
    • Hours
    • Days
    • Months
    • Years

    To have documents expire after specific number of views, turn the switch beside Expire after an Amount of Views on and enter the number of Views before the document expires.

    Note: You can apply both expiration options at the same time. Whichever option that happens first will trigger the expiration.

    Finally, click Apply.

📘

Note: If you want to change the Salesforce settings of your template, click the settings gear on the Salesforce icon in the Destinations panel of the template.