Troubleshooting Sticky Account Names on Leads
Overview
In Sugar®, users have the ability to type any text they choose into the Account Name field on a lead record. Entering text in this field does not create a relationship between the lead and an account record. Rather, it is meant to be an informal record of the lead's organization that does not require the organization to be entered as an Account record in Sugar.
Confusion often results when a user attempts to alter the Account Name field on a lead record if a relationship exists in the background between the lead and an account record. After clicking save, the field appears to revert to its previous value. This article will explain the underlying cause and how to resolve the conflict.
Beginning with version 9.1.0, each user's license type (e.g. Sugar Serve) determines what functionality is available as described in the License Types Matrix documentation. Please note that the Leads module is not available for Sugar Serve users.
Symptom
Users cannot change a lead's Account Name field. Upon saving, Sugar reverts the Account Name field to its previous value.
Cause
Lead records contain two account-specific fields:
- Account Name (
account_name
) : The Account Name field is a simple text field which informally records the lead's organization without requiring the organization to be entered as an Account record in Sugar. Upon conversion to a contact, the account will be created as a separate, related record. Since this is a text field rather than a relate field or relationship, no connection is made to the Accounts module. - Account ID (
account_id
) : The Account ID field stores the database ID of an account record and represents a relationship between the lead and the account. This field is not visible in Sugar, meaning users cannot edit or view it while working with a lead. Instead, the field can be populated when a relationship between the lead and account is created in one of two ways:- Importing leads where the Account ID field is populated with an existing account's database ID
- Creating a lead from the Leads subpanel of an account's record view
When both of these fields are populated on a lead, Sugar will ignore the value stored in the account_name
database field and use the Account Name field visible in Sugar to display the name of the account record associated with the Account ID value. When a user attempts to edit the Account Name field on the lead, the database will store the new text in the database's account_name
field, but Sugar will continue to display the name of the account associated with the Account ID.
Note: Converting a lead to a contact when the lead contains both an Account Name and an Account ID uses the Account ID field is to establish the relationship between the contact and account while the Account Name value is not carried over to the converted contact.
Resolution
To resolve the conflict between the Account Name and Account ID fields, you must clear the Account ID value from the database so it no longer overrides the value displayed in Sugar. This can be done via import or by directly updating the database. The following sections walk through both approaches.
Clearing the Account ID via Import
Any user with role permission to import and export lead records in Sugar can clear the Account ID for a lead using the following method:
- Navigate to the Leads module's list view.
- Filter the list to display the record(s) that you wish to modify. Select the checkboxes next to those records and then select "Export" from the list view's Actions menu.
- Open the exported .csv file using Microsoft Excel or another spreadsheet application on your computer.
- Find the column labeled "Account ID".
- Delete the Account ID values from under this heading.
- Save the edited .csv file and import it back into the Leads module to override the existing record's Account ID with a blank value. Be sure to select "Create new records and update existing records" in step 2 of the Import Wizard. For complete steps on how to perform an update via import, please refer to the Updating Records Via Import article.
When the import is completed, the account name that you attempted to save earlier will appear in the Account Name field on the lead record. Alternatively, you can now edit the lead's account name in Sugar as desired.
Clearing the Account ID Directly in the Database
If you are the administrator of a Sugar instance hosted on-site and have direct access to the database, you can use the following steps to clear a lead record's Account ID field:
- In Sugar, navigate to the lead record you wish to modify and retrieve its unique ID. The ID is the string of characters immediately following
#leads/
in the record's URL. For example, in the URLhttp://mysugarinstance.com/#leads/507438d7-b823-f30e-1bb1-55ba3f52843d
, the lead's database ID is507438d7-b823-f30e-1bb1-55ba3f52843d
.
Note: Alternatively, you can retrieve the lead's ID directly through the database if you know the values of some of the lead's fields, such as their first name and last name, with a query similar to the one below:SELECT id FROM leads WHERE last_name = 'Greenan' AND first_name = 'Duane';
- Once you acquire the ID number, use the query below to update the Account ID's value to a null value, replacing the ID string between the single quotes with the record ID you retrieved in step 1:
UPDATE leads SET account_id = NULL WHERE id = '507438d7-b823-f30e-1bb1-55ba3f52843d';
Once the change has been made via the database, the account name that you attempted to save earlier will appear in the Account Name field on the lead record. Alternatively, you can now edit the lead's account name in Sugar as desired.