Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to get 'Call From' and 'Call To' of all phone call in WEB API

(1) ShareShare
ReportReport
Posted on by 32

In OrganizationService, I can easily get the 'Call From' and 'Call To' of phone call by using columns 'From' and 'To' , either thought fetch XML, or using RetrieveEntityRequest, it's quite straight forward.

but in Dynamics 365 WEB API, these two columns not returned, need using $expand or link-entities in fetch xml, is there any other ways to get these two columns ?

  • cloflyMao Profile Picture
    25,208 on at
    RE: How to get 'Call From' and 'Call To' of all phone call in WEB API

    Hi Flex Xuan,

    Please kindly let me know whether it could work for you. Thanks.

    Regards,

    Clofly

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: How to get 'Call From' and 'Call To' of all phone call in WEB API

    Hi Flex Xuan,

    'Call From' and 'Call To' are party list type field, they will be saved as separate activityparty entity records.

    In other word, there will be two activityparty records for a phone call record. 

    We should instead expand activityid_phonecall property to show fields of related phone call record.

    e.g:

    display 'Call From' and 'Call To' field of a specific phone call record:

    var entityId = 'xxxx'; // phone call record id
    Xrm.WebApi.retrieveMultipleRecords("activityparty", "?$expand=activityid_phonecall($select=subject)&$filter=_activityid_value eq "   entityId 
                  " and (participationtypemask eq 1 or participationtypemask eq 2)&$select=_partyid_value,_activityid_value,participationtypemask").then(
        function success(result) {
            for (var item in result.entities) {
                if (result.entities[item]["participationtypemask"] === 1) {
                    console.log("Phone call activity: "   result.entities[item]["_activityid_value"]   ", Subject: "   result.entities[item]["activityid_phonecall"]["subject"]   ", Call From: "   result.entities[item]["_partyid_value@OData.Community.Display.V1.FormattedValue"]);
                } else if (result.entities[item]["participationtypemask"] === 2) {
                    console.log("Phone call activity: "   result.entities[item]["_activityid_value"]   ", Subject: "   result.entities[item]["activityid_phonecall"]["subject"]   ", Call To: "   result.entities[item]["_partyid_value@OData.Community.Display.V1.FormattedValue"]);
                }
            }
        },
        function (error) {
            console.log(error.message);
        }
    );

    pastedimage1587457342646v1.png

    If activity entity is "PhoneCall", then when participationtypemask field of activityparty record equals to 1, it stands for Call From,

    when the field equals to 2, it stands for Call To.

    In a word, we should retrieve phone call based on activityparty entity.

    Furthermore, we can also retrieve "From" and "To" fields of Email based on it.

    Here are some helpful links about your question:

    1. participationtypemask code meaning for different activity entities:

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/activityparty-entity

    2. available properties to expand of activityparty entity:

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/activityparty?view=dynamics-ce-odata-9#single-valued-navigation-properties

    3. a tutorial about the topic:

    https://promx.net/en/2020/01/how-to-retrieve-an-activity-party-list-in-microsoft-dynamics-365-using-web-api/

    Regards,

    Clofly

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,137 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,879 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans