Skip to main content

Use Merge Fields to Make Prompts Context-Aware

Overview

Merge Fields in GPTfy let you bring live Salesforce data, like Account.Name, Owner.Email, or Contact.Title—into your prompt commands. This makes your AI outputs more relevant, personalized, and grounded in real CRM context.

Why Use Merge Fields?

  • Ensure AI receives the most accurate and up-to-date CRM data.
  • Prevent AI hallucination by explicitly providing important context.
  • Help personalize outputs based on record-specific information.

Note: To get the most out of this feature, ensure your Related Fields are properly mapped in the Data Context Mapping section.

GPTfy supports relationships up to 5 levels deep
(e.g., Opportunity → Account → Owner → Manager → Email)


Step-by-Step: How to Use Merge Fields

1. Open Field Mapping

  • Go to your Salesforce environment.
  • Open a Data Context Mapping record.
  • Click to open the Field Mapping window.

alt text

  • In the Field Mapping window, click Add Related Field.
  • This helps you easily pick fields from related objects up to 5 levels deep.

3. Select the Object

  • Click Select Fields.
  • You’ll see a list of related objects connected to your parent object.

alt text

4. Choose Your Fields

  • Pick the related fields you need.

5. Copy the Merge Field Format

  • Click the copy icon next to the field name.
  • This copies the relationship-formatted field path.

6. Insert It Into Your Prompt

  • Paste the field name into your prompt command.
  • Wrap it in triple curly braces: {{{Account.Owner.Name}}}

alt text

Note: Triple curly braces ensure Salesforce merge field formatting is applied correctly.

7. Add More Fields (Optional)

  • Use multiple fields from the same or different related objects to enrich your prompt.

alt text

8. Save and Activate

  • Save the Text Prompt.
  • Click Activate.
  • Run the prompt on a record to test if the data from the merge field is properly extracted.

alt text


Best Practices

  • Use clear field names to keep prompts easy to read.
  • Test on multiple records to ensure data is consistently extracted across variations.
  • Avoid overloading prompts with too many fields unless necessary.
  • If a field might be blank, configure the Blank Replacement Value setting under GPTfy Settings to ensure smooth outputs.

Important Notes

  • Merge Fields can be used in prompts of Text type only (not JSON).
  • If a field is mapped but not selected through Add Related Field, you can still manually use its path if you know it.
  • Salesforce dynamic formula fields (introduced in GPTfy 1.10) can also be leveraged via the Add Formula Field option in Field Mapping.