Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Entity Metadata / Entity Type code

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

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

  • Suggested answer
    PerezAguiar Profile Picture
    PerezAguiar 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?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans