Dynamics 365的通話記錄phonecall,ActivityPointer和phonecall的關係

溜溜球_小钢wan發表於2024-07-12
SELECT top 100
    P.ActivityId, -- PhoneCall ID
    P.Subject, -- PhoneCall Subject
   -- AP.PartyId, -- Recipient ID
    con.FullName -- Recipient Name
    ,l.leadid,l.parentcontactid,con.emailaddress1,ca.createdon,ca.phonenumber
FROM 
    ActivityPointer AS P 
Inner join lead l on p.regardingobjectid=l.leadid  --關於是Lead的寫法
inner join contact con on l.parentcontactid=con.contactid
inner join phonecall ca on p.ActivityId=ca.ActivityId
WHERE 
    P.ActivityTypeCode = 4210 -- PhoneCall Activity Type Code
    order by ca.createdon desc

相關文章