Saturday, 23 November 2013

Salesforce: Change account owner

Do you know or realize, when account owner is changed manually through salesforce UI the new owner will also gain ownership of

  • all notes and open activities for this account (completed activities will not be transferred)
  • all contacts tagged to account owned by old owner
  • all opportunities tagged to account (including closed opportunities if you select the "Transfer closed opportunities" and opportunity owned by different owner if you select "Transfer open opportunities..." as screenshot below












But, if  you change the account owner through API, or API tool such as: Data Loader, only the Account Owner is changed. It will not change owner of contact, opportunity and other object related.

To change Account Ownership using the Data Loader:

1. Use the Data Loader to export the Account table to a .CSV file.

2. Use the Data Loader to export the User table to a .CSV file.

3. Copy the contents of both files (1 and 2) into an Excel workbook;

4. Add a column to use as the lookup criteria (Sheet "Account" Column D "Owner Name" in the attached sample).

5. Use an Excel VLookup formula to return\populate the User ID from the entries in the new Column (4).

Attached is a sample Workbook which illustrates a VLookup for Account Owner (by Username) and returns the ID of the User.

Sheet User is an export of the User table (fields ID and UserName)
Sheet Account is an extract of the Account table (fields ID, Name, and OwnerID)

Here's how the VLookup works.

When a value (UserName) is entered/pasted into the Owner Name Column (Account Sheet: Column D), the VLookup formula in the corresponding Column C attempts to match the value entered with all values in both columns A & B of the User sheet.
If a match is found, the value in Column B (The User ID) is returned.
If no match is found, the cell will show "#N/A" to indicate that a match could not be found.

Notes:
In this Case the UserName field is used for the Lookup, any other field (e.g. Alias, LastName...etc) can be used as the VLookup - lookup criteria
To use the Data Loader to update the Account records, the Account Sheet needs to be saved as a .CSV file.

No comments:

Post a Comment