RE: Entity Metadata / Entity Type code
Hi Daniel,
Thanks for the suggestion. It's not really what I'm looking for.
Finally, I wrote this code.
SELECT
TOP 100
--regardingobjectid,
--regardingobjectidname,
regardingobjecttypecode,
appointment.subject,
--ActivityTypeCodeName,
account.ctx_easynumber 'Account number',
account.address1_city 'Account city',
opportunity.name 'Opportunity name',
opportunity.ctx_mainopportunityreference 'Opportunity reference',
lead.firstname,
lead.lastname
FROM appointment
LEFT JOIN account
ON account.accountid = appointment.regardingobjectid
AND appointment.regardingobjecttypecode = 1
LEFT JOIN opportunity
ON opportunity.opportunityid = appointment.regardingobjectid
AND appointment.regardingobjecttypecode = 3
LEFT JOIN lead
ON lead.leadid = appointment.regardingobjectid
AND appointment.regardingobjecttypecode = 4
WHERE
appointment.regardingobjectid IS NOT NULL
Greetings, Hicham