Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Inserting Emails in MySQL from another table

Inserting Emails in MySQL from another table 1 week 4 days ago #90354

  • jalamani
  • jalamani's Avatar
  • Offline
  • New Member
  • Posts: 18
  • Karma: 0
I am inserting data in MySQL into the contacts module/table from another tables, but the 'contacts' table does not have an email address column. I see that 'contacts_cstm' and 'contacts' have a primary key 'id', but when I look at the email tables, I cannot find the corresponding primary key between contacts and email addresses.

So my question is how do I write the query that adds emails from my table to the contact's emails table in SuiteCRM?

Below is the query I use to insert most of the fields
INSERT INTO contacts(
    id,
    first_name,
    last_name,
    photo,
    phone_home,
    phone_mobile,
    phone_fax,
    primary_address_street,
    primary_address_city,
    primary_address_state,
    primary_address_postalcode,
    birthdate,
    /*email would ideally go here in this query*/
)
SELECT
    ClientID,
    Firstname,
    Lastname,
    Photo,
    Homephone,
    Mobilephone,
    Fax,
    Address,
    City,
    `State/Prov`,
    Zipcode,
    DoB,
    Email1 ,
FROM
    exampletable;
The administrator has disabled public write access.

Inserting Emails in MySQL from another table 1 week 4 days ago #90361

  • ashish@outrightcrm.com
  • ashish@outrightcrm.com's Avatar
  • Offline
  • SuiteCRM Is My Life
  • CTO at outright Systems
  • Posts: 445
  • Thank you received: 52
  • Karma: 5
Hi,

SuiteCRM stores the email address in a different way because SuiteCRM offers multiple email addresses for one record functionality.
SuiteCRM database has 2 tables:-

1. email_addresses - It saves the email address of the SuiteCRM
2. email_addr_bean_rel - It saves the relationship of email address and record.

The email_addr_bean_rel table has columns:-

1. email_address_id - Id of the email_addresses table
2. bean_id -  Id of the record (Contacts/Leads/ Accounts or custom module)
3. bean_module -  It gives the name of the module  (Contacts/Leads/ Accounts or custom module)

Thank You!
The administrator has disabled public write access.
Time to create page: 0.038 seconds
Powered by Kunena Forum