Skip to content

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Sep 25, 2025

What does this PR do?

This PR adds Salesforce Account duplicate prevention functionality by creating:

  • A Matching Rule that performs exact matching on Account Name field
  • A Duplicate Rule that blocks creation of Accounts with duplicate names
  • A new Salesforce DX project structure in the salesforce/ directory

The duplicate rule is configured to block on insert but allow updates, providing a safety net against accidental duplicate Account creation while maintaining flexibility for legitimate updates.

Acceptance Criteria

Matching Rule (Account) and Duplicate Rule (Account) exist and are Active

  • Created "Exact Account Name" matching rule with EXACT method on NAME field
  • Created "Account Duplicate Rule" that references the matching rule and blocks on insert

Attempting to create a second Account with the same Name is blocked with duplicate warning error in UI and via CLI

  • CLI test: sf data create record -s Account -v "Name='DupTest Co'" twice - second attempt failed with duplicate error
  • UI test: Attempting to create second "DupTest Co" account showed "We hit a snag" duplicate error dialog

Existing (first) Account remains intact

  • Original Account records preserved and visible in Account list view

Testing Notes

Manual Testing Performed:

  • ✅ CLI duplicate prevention: Created account via sf data create record, second identical creation blocked
  • ✅ UI duplicate prevention: Used Lightning Account creation form, duplicate blocked with error dialog
  • ✅ Rule activation: Verified both Matching Rule and Duplicate Rule show as Active in Setup

Test Scenario: Used "DupTest Co" as test Account name to verify exact name matching behavior.

Additional Testing Recommended:

  • Test with special characters, different casing, and whitespace variations
  • Deploy to fresh org to verify metadata deployment process
  • Test with bulk data operations

Checklist

  • This change has been approved by the CLI Review Board or approval isn't required. Anything that adds/changes/deletes commands, flags, output, or json output has to be reviewed.
  • Does this follow the deprecation policy?

What issues does this PR fix or reference?

Link to Devin run: https://app.devin.ai/sessions/d6019e698c8c4514884cb5c763d5925b
Requested by: @alexpeng-cognition

Screenshots

Duplicate blocking in UI

Human Review Focus Areas

🔍 Critical Review Items:

  • XML Schema Validation: Verify the metadata XML structure matches Salesforce schema requirements
  • Rule Reference Integrity: Confirm Account.Exact_Account_Name reference in duplicate rule is correctly formatted
  • Project Structure: Validate that placing Salesforce project in salesforce/ directory aligns with repo conventions
  • Deployment Testing: Test metadata deployment to a clean org to ensure no deployment issues

devin-ai-integration bot and others added 7 commits September 25, 2025 01:33
…le (block on create)

Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
…teRule shape

Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
…t_Name.matchingRule-meta.xml)

Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
…ule match rules

Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
Co-Authored-By: Alex Peng <alex.peng@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant