Conditions for breaking relationship between lead and primary email

I am currently using v7.7 and am running it on a CENT OS/Apache server.

I’ve created a scheduled job that checks all leads and verifies that data in a custom field is the same as the data in a core field (account_id) in a Lead bean.

Essentially, when leads are imported, they are new and have no id established. The lead list to be imported only has the following fields: First Name, Last Name, City, State, Email address, phone #, and follow up date.

At first all data imports correctly. Links to a lead’s company gets established, and the email gets imported as well.

The scheduled job I run to check to make sure the Account ID field and my custom field are the same executes every minute.

Yet, within a minute, all the email addresses in the lead list column begin to disappear. I’ve checked the database and it looks like the email addresses are still there, but the relationship table (email_addr_bean_rel) marks the relationship as deleted. If I go back and manually undelete the relationship, the email doesn’t get re-deleted when the scheduled job runs again.

Do you think that because my scheduled job runs every minute that the CRM breaks the relationship because the two fields aren’t matching just yet?

What conditions does the CRM look for to automatically break the relationship between Lead records and their email address? :S

Hi appomattox,

are you using the importer to import the data ?

assuming the scheduled job is not importing and only altering the imported leads, if you disable the scheduled job does the import job run successfully and not delete the relationship ?

also worth adding if the lead is entered manually and this script is run on that lead does the email address get deleted as seen with imported ones ?

Thanks for getting back to me.

Yes, I am using the importer to import the data.

The scheduled job is designed to only alter the leads, primarily to create links between the lead and corresponding account based on the company name,

When I disable the scheduled job, the email address link remains, nothing gets broken.

Additionally, when a lead is entered manually, the scheduled job, again causes the email address link to break.

If you’re curious, I’ve asked for help on Stack Overflow and have written my scheduled job script at the following:

My guess is that when I access the lead bean and save it, the email address is missing and then the CRM interprets that as a deleted email address. I can’t prove it because I don’t know what is included in a bean.

See what I’m saying?

Have you been able to find anything on this one?

Im afraid not.

I is down to the scheduled job from what you have said, so without recreating your functionality it is hard to tell. there is a good chance that the scheduled job is running to quickly after the import. so might be worth waiting till the import is finished and try running the job after that to see if that changes anything ?


I thought that might be an issue, so I tested it with a list that had three records and run the scheduled job every 10 minutes. Same thing happens.

I’m curious if it has something to do with the fact that email addresses are a related field. All other fields I import, which are not related fields, are never affected by the scheduled job (primary city, state, phone number, first name, last name). All I’m trying to do is create a new relationship between a lead record and an account record.

I have a question about that. By default, leads are never formally connected to accounts until after you convert them. Why? Leads have an account field but its not a relate type of field, not until it becomes a contact.

All clients I’ve come in contact with want to make sure that their leads are connected to their corresponding accounts so they can go to an account record and look up all associated lead records in a sub panel.

What’s the thinking behind that choice?