When we create a contact that has the same company_name as existing contacts, then do an update for that contact that includes a different company_name, it changes the company_name for all contacts in the system that had the previous value.

Scott,
short answer is company_name will be changed for all contacts within this company in one case, when company_id also present in request and not changed and new company_name is unique.

Full answer with all cases for company change in contact update:

Full update (without partial param)

  1. company_name is only provided
    • with multiple contacts within company, contact will be moved to other company (split)
    • if last in company, contact will be moved to other existing company and error will be raised if company has some details and cannot be removed
    • if last in company, company will be renamed if name is unique
  2. company_id is only provided
    • with multiple contacts in company contact will be moved to other company
    • when last in company, contact will be moved to other company and error will be raised if company has some details and cannot be removed
    • Error will be raised if invalid ID will be provided
  3. Both company_id and company_name are present
    • when company_name is only changed, contact will be moved to other company if company with given name exists
    • when company_name is only changed, company will be renamed if name is unique
    • will raise error if invalid ID will be provided
    • when last contact in company, move will be allowed only if company does not contain any data
    • when both values are different, contact will be moved to new company and the other company will be renamed; error will be raised when new name is not unique
    • if any of those will be set to null, contact will be removed from company
  4. neither company_id nor company_name are present
    • when multiple contacts in company, contact will be removed from company
    • will remove company details only if it is not containing any data
    • company cannot be removed from contact which does not have lastname

Partial update (with partial=1)

  1. company_name is only provided - the same behaviour as in case of full update
  2. company_id is only provided
    • contact will be moved into new company
    • if last contact in company, error will be raised if company contains some data
    • error will be raised if invalid ID will be provided (i.e. company does not exists)
  3. both company_name annd company_id are present - the same behaviour as in case of full update
  4. neither company_id nor company_name are present
    • no action on company data will be taken

I hope this answer helps.

Update : corrected rules for case company_name is only provided.

Kind regards,
Mikhail

Uploading...
Saving...
You have a post draft in progress. Click anywhere in this box to resume editing.