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 ?
Hi Flex Xuan,
Please kindly let me know whether it could work for you. Thanks.
Regards,
Clofly
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);
}
);
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:
2. available properties to expand of activityparty entity:
3. a tutorial about the topic:
Regards,
Clofly
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156