Domanda

I'm using sugarCRM CE 6.5.14.

I would like to export leads history ( mail details) section. I googled but the details are/were not enough to complete my requirement.

Normal leads > export > not having this history section.

È stato utile?

Soluzione

Here is the SQL Query that I used. It works for me.

SELECT l.first_name, l.last_name, l.id, group_concat(n.name), n.description
FROM leads AS l 
inner join notes as n on l.id = n.parent_id
where l.deleted = 0 and n.deleted = 0
group by l.id

Hope this will help to some one like me.

Altri suggerimenti

There is no way of using the SugarCRM CE UI to export Email records. The closest you can get is to derive the URI index.php?module=Emails&entryPoint=export which will give you the data about an email record (e.g. subject, related to information, status). It won't provide the sender, recipient or email content.

That means you'll need to get into the database or use a GUI reporting tool like JasperReports.

A query that pulls all emails (meta-data and content) from the database would be

select
  name,
  to_addrs,
  cc_addrs,
  bcc_addrs,
  description,
  description_html,
  parent_id,
  parent_type 
from emails 
join emails_text on emails.id = emails_text.email_id;
/* where parent_id = '<your lead id>' */

You should know that the Lead History subpanel is populated two ways in regards to Emails. Emails can be directly related to a lead, i.e. parent_id = the lead guid. They can also show up there if the email address matches. This happens if an email is related to an Opportunity or a Contact, but the to_addrs or from_addrs contain an email address that matches an email address that is also on file with the Lead. The above query does not take this non-directly-related emails into consideration. For a query that'll help with that, I recommend you dig into include/utils.php and check out a function called get_unlinked_email_query().

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top