web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Entity Metadata / Entity Type code

(0) ShareShare
ReportReport
Posted on by 200

Hi,

I'm trying to dsiplay information from appointment and other data based on the regarding object (account, opportunity, lead...). 

To make this work, I assume I shoud do a join with the medata entity and then display the needed fields . I looked for the metadata entity but it's not present. 

pastedimage1639601053861v1.png

Thanks, 

KR,

Hicham

I have the same question (0)
  • Suggested answer
    PerezAguiar Profile Picture
    Microsoft Employee on at
    RE: Entity Metadata / Entity Type code

    Hey Hicham.

    On https://community.dynamics.com/365/f/dynamics-365-general-forum/402451/customer-guide-how-to-reduce-activitypointerbase, there's a nice query that counts records and shows if htey're appointment, etc.  Perhaps that should be your base, as it uses ActivityPointer table

    Maybe a join between Appointment and ActivityPointer table?

  • Hicham GRC Profile Picture
    200 on at
    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 117

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#3
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 83

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans