Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The external ID provided matches more than one record #243

Open
CarlosLCervantes opened this issue Jul 5, 2016 · 3 comments
Open

The external ID provided matches more than one record #243

CarlosLCervantes opened this issue Jul 5, 2016 · 3 comments

Comments

@CarlosLCervantes
Copy link

Since updating to the new version I am seeing many "The external ID provided matches more than one record" when using upsert.

Example of how I am using upsert. Which runs whenever my User model is changed.

response = @client.upsert!('Lead', 'Email',
  :Email => @user.email,
  :FirstName => @user.first_name,
  :LastName => @user.last_name)

Since I am using upsert. It shouldn't be possible to created multiple Leads on Salesforce with the same email. Any ideas?

@timrogers
Copy link
Collaborator

Sounds like a Salesforce issue rather than a Restforce one! What happens if
you query for Lead records with one of these emails?

Tim Rogers
GoCardless.com https://gocardless.com

On Tue, Jul 5, 2016 at 9:46 PM, Carlos Cervantes notifications@github.com
wrote:

Since updating to the new version I am seeing many "The external ID
provided matches more than one record" when using upsert.

Example of how I am using upsert. Which runs whenever my User model is
changed.

response = @client.upsert!('Lead', 'Email',
:Email => @user.email,
:FirstName => @user.first_name,
:LastName => @user.last_name)

Since I am using upsert. It shouldn't be possible to created multiple
Leads on Salesforce with the same email. Any ideas?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#243, or mute the thread
https://github.com/notifications/unsubscribe/AAHFpntOFv0i05-uzbWYZzD5YfSQC3Igks5qSsKSgaJpZM4JFg6m
.

@CarlosLCervantes
Copy link
Author

I'm only seeing this for a handful of users which makes me think there is some user error from the sales team involved.

I've confirmed that I can call upsert! multiple times, on a newly created user, and it will work as expected. I was trying to query Salesforce to confirm that manual duplicates have been created. But, none of my queries were working. All three of these queries return no results for users I know exist in Salesforce. I wonder what I am doing wrong?

accounts = client.find('Lead', "user01@gmail.com" , 'Email')
accounts = client.query("select Email, Street from Lead where Email = 'user01@gmail.com'")
accounts = client.query_all("select Street from Lead where Email = 'user01@gmail.com'")

Either way, upsert! is working and that's all I need to worry about. I'll close out this issue in a bit.

@espen
Copy link
Contributor

espen commented Oct 13, 2016

Email is not a unique field in Salesforce. So if you have two leads with the same email then Salesforce don't know which record to update and raises this error.

It's a feature, not a bug:

If the external ID value isn't unique, an HTTP status code 300 is returned, plus a list of the records that matched the query. For more information about errors, see Status Codes and Error Responses.

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm

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

No branches or pull requests

3 participants