Introduction
Salesforce works best with structured data—but real-life processes rarely start that way.
You deal with:
- Business cards
- PDFs
- Scanned documents
- Uploaded images
All of these contain valuable information, but none of it is directly usable inside Flow.
With Prompt Templates, you can now take those files, extract meaningful data, and turn them into actionable records—automatically.
What Makes This Powerful
A Prompt Template allows you to:
- Define reusable AI instructions
- Pass dynamic inputs (records, variables, or files)
- Process real file content (not just metadata)
Supported file types:
- Images (JPG, PNG)
- PDFs
- Text files
Limitations:
Use Case: Business Card to CRM Data
To make this practical, let’s walk through a simple scenario:
- User uploads or takes a photo of a business card
- Salesforce extracts the contact details
- Flow creates or updates records automatically
Step 1: Create a Prompt Template
Template Setup
- Type: Flex Prompt Template
- Add a required input:
- Name: File
- Source Type: Object
- Object: File
Prompt Instructions
Define a clear instruction:
You are an AI agent that extracts contact details from a business card photo.
Extract the following fields: First Name, Last Name, Title, Company Name, Email, and Mobile Phone.
Return the response in JSON format.
Expected Output
{
"FirstName": "Yumi",
"LastName": "Ibrahimzade",
"Title": "Salesforce Solution Architect",
"CompanyName": "Salesforce Time",
"Email": "info@salesforcetime.com",
"MobilePhone": "0549000000"
}
Key Configuration
- Insert the File input into the prompt
- Select a model (e.g., Google Gemini 2.5 Pro)
- Set response format to JSON
Test It
Preview the template with a real image:
- The file is processed
- Data is extracted
- JSON is returned
Step 2: Build an Autolaunched Flow
This flow acts as the processor behind the scenes.
Flow Logic
- InputContent Document Id
- Get FileRetrieve Content Document record
- Call Prompt TemplatePass the file as input
- Extract JSON ValuesMap fields:
- FirstName
- LastName
- Title
- Email
- MobilePhone
- CompanyName
- Assign OutputsStore values in Flow variables
Step 3: Build the Screen Flow
This is what the user interacts with.
Screen 1: Upload or Capture Image
- Allow file upload or mobile photo capture
- Pass the file to the autolaunched flow
Auto Processing
Once the file is uploaded:
- The screen action calls the autolaunched flow
- The autolaunched flow calls the Prompt Template
- Data is returned and mapped automatically
Pre-Filled Fields
All fields (First Name, Last Name, etc.):
- Are automatically populated
- Use default values from the processed results
Improve User Experience
Since processing takes a few seconds:
- Disable input fields while processing
- Use the “In Progress” flag from the screen action
- Prevent users from editing incomplete data
Step 4: Create or Update Records
After extracting the data, the Flow continues with logic such as:
Record Handling
- Check if Lead already exists
- Check if Contact already exists
Based on Results
- If exists → create Campaign Member only
- If not → create Lead + Campaign Member
Example Flow Behavior
- User uploads business card
- Data is extracted automatically
- System checks for duplicates
- Creates only what is needed
- Assigns final record IDs
End-to-End Flow Summary
- Capture file
- Process with AI
- Extract structured data
- Validate existing records
- Create CRM records automatically
Where This Becomes Useful
This is not limited to business cards.
You can use the same approach for:
- Resume parsing (extract candidate data)
- Processing invoices or documents
- Reading screenshots or customer submissions
- Creating cases from uploaded files
Benefits
- Eliminates manual data entry
- Converts unstructured data into usable fields
- Speeds up operations
- Reduces errors
- Improves user experience
Final Thoughts
Prompt Templates unlock a new layer of automation in Salesforce.
Instead of relying only on structured inputs, you can now:
- Read files
- Understand content
- Extract data
- Act on it instantly
This shifts Flow from simple automation to intelligent data processing—and that’s where things get interesting.