0

Whenever I upsert a contact, it is created with a corresponding account. For example, if I create 'Contact A', an account with name 'Contact A' will also be created and will contain 'Contact A' as a contact. Is there any way to upsert only the contact without the account?

Thanks!

sophistry
  • 117
  • 1
  • 2
  • 12
  • Can you post a sample of the code you are using to upsert a contact. It isn't native behavior of Salesforce to automatically create an account for a contact. Could be you are working with person accounts, a trigger is creating it for you, or you have the account information present on the contact object you are upserting. – John De Santiago Jul 20 '12 at 17:31
  • Some code would help. it sounds like you might have person accounts turned on. – superfell Jul 20 '12 at 17:35
  • Person accounts, custom trigger code or validation rules could cause this behavior. – Adam Jul 20 '12 at 21:28

1 Answers1

1

The relationship between the Account and Contact objects is what Salesforce calls a "Master-Detail relationship" (although as superfell has pointed out, it's not a true Master/Detail relationship). When a "master" record is deleted, all associated "details" are also deleted, and typically a record of the detail type cannot be created without being associated to a master; however, in this case a Contact record can be inserted without being associated to an Account assuming there are no custom restrictions in place. It sounds like your Account record is being created by a BeforeInsert trigger on the Contact object.

JCD
  • 2,211
  • 1
  • 19
  • 29
  • 2
    account to contact is not a true M/D relationship, its perfectly valid to have contacts with no accountId. – superfell Jul 20 '12 at 17:33
  • Good call, the orgs I'm working with have a custom restriction in place. I'll update my answer. – JCD Jul 20 '12 at 17:36
  • Is this a trigger I customize in the SalesForce settings, or when I create a Contact object? – sophistry Jul 23 '12 at 11:49
  • From the Setup menu, navigate to Customize -> Contacts -> Triggers. If you don't see any triggers in the list there, you may very well have Person Accounts enabled as a few others on this thread have mentioned. To check for this, try to create a new Account record and see if you have the option of "Person Account" when selecting the record type. – JCD Jul 23 '12 at 12:04
  • I have something called IndividualAccounts, which I think would correlate because contact-only entries create accounts of type 'Individual'. It's part of a package, though, so I can't edit it or even view the code. How can I work around this? – sophistry Jul 23 '12 at 17:11
  • Contacted the administrator, and the trigger is to remain in place. I'll just have to work with duplicate accounts. Thanks for your help! – sophistry Jul 23 '12 at 17:36