Filling And Checking Duplicate Records Using AI Voice Agent

In this guide, we will explain how to fill in records and check for duplicate records from a Salesforce object. In this example, we will use the Voice Agent field to fill in the record details and to check whether a record with the same Account Name and Phone Number already exists in Salesforce. The AI lets us know, using audio, if a record with the same details is available and asks us whether we want to create the record or not.

1. INITIAL SETUP:

  • Drag and drop a "Salesforce Table", a "JavaScript", a "Voice Agent", and an "AI Prefill" field onto your form to set up the AI Voice Agent.
  • Rename the fields as needed.
image
  • Drag and drop four "Hidden" fields onto your form and rename them: "Record Contexts for AI", "AI Voice Response", "Duplicate Found", and "AI Prefill Prompt".
image
  • Drag and drop the fields you want the AI to fill. Here we are using a "Text" field for Name, a "Phone" field for Phone, and a "Text" field for Type to capture the Account details.
image

2. CONFIGURE THE "SALESFORCE TABLE" FIELD:

  • Click the pencil icon of the "Salesforce Table" field.
  • Set up the field:
    • Object: Select Account (the object the AI will check against).
    • Select Table Fields: Name,Phone,Type (the fields pulled for each record). Keep these aligned with the details the AI will extract.
    • Returned Record Count: 50 (the maximum number of records returned). Keep this reasonable.
image
  • Here, 3d16-a03d-2758 is the component ID of the "Salesforce Table" field. You will use it in the next step.
image

3. CONFIGURE THE "JAVASCRIPT" FIELD:

  • Click the pencil icon of the "JavaScript" field.
  • This script hides the Salesforce Table from the user, shows a loading spinner, and stores the table records as JSON in the "Record Contexts for AI" hidden field so the AI has data to compare against.
  • Here, 3d16-a03d-2758 is the component ID of the "Salesforce Table" field and 1459-a3cd-0021 is the component ID of the "Record Contexts for AI" hidden field.
image
  • Please use this code:

4. CONFIGURE THE "VOICE AGENT" FIELD:

  • Click the pencil icon of the "Voice Agent" field.
  • Set up the field:
    • Read Text From Field: Here, a1f2-b3c4-d5e6 is the component ID of the "AI Voice Response" hidden field. The agent reads this field aloud to the user.
    • AI Prefill Component Id: Here, da78-f3f8-f209 is the component ID of the "AI Prefill" field that runs when the user finishes speaking.
    • Voice Agent Welcome Message: (Optional) Enter a message users hear when the form loads (e.g., "Hi! Tell me the account you want to look up, or describe a new account you'd like to create.").
image

5. CONFIGURE THE "AI PREFILL PROMPT" HIDDEN FIELD:

  • Click the pencil icon of the "AI Prefill Prompt" hidden field.
  • Add the AI's system instructions in the "Value" field.
image

Please use this example Prompt:

6. CONFIGURE THE "AI PREFILL" FIELD:

  • Click the pencil icon of the "AI Prefill" field.
  • Add the AI Prompt. This combines the system prompt, the existing records, and the conversation so far.
  • Here, c4d5-e6f7-a8b9 is the "AI Prefill Prompt" hidden field, 1459-a3cd-0021 is the "Record Contexts for AI" hidden field, and ba64-55fc-9333 is the "Voice Agent" field.
image
  • Please use this Prompt:
{{c4d5-e6f7-a8b9}}

Existing Salesforce account records:
{{1459-a3cd-0021}}

Conversation so far as a JSON array, where type user is the person speaking and type assistant is you:
{{ba64-55fc-9333}}
  • Map Data Key (AI output values) to Form field:
    1. name - c008-764e-de46 (Name)
    2. phone - daa5-7f5d-61aa (Phone Field)
    3. type - d83a-2d46-6ec6 (Type)
    4. duplicate_found - f1a2-b2c3-d4e5 (Duplicate Found)
    5. agent_response - a1f2-b3c4-d5e6 (AI Voice Response)
image

7. TEST THE FUNCTIONALITY:

  • Try the Form. The Salesforce Table loads in the background and is hidden (you may see a brief loading spinner).
image
  • Click the "Start Speaking" button.
image
  • Give the voice instructions to search for an account (e.g., "Find an account named Test."). The Voice Agent will describe any matching records aloud.
image

Note:

  • The user can also provide instructions for filling in the fields and can ask the AI agent to check for duplicate records.
  • The user can also enter or edit the details manually before submitting.
Example Form.json12.6 KiB

For any questions, please contact us - [email protected] or the Formyoula in-app chat. 🙂