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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create Phone call activity using user id and contact id

(0) ShareShare
ReportReport
Posted on by

Hi,

I need to create a phone call activity for the contact using user id and contact id i.e activity party as from - to. (I have used Organization Service)

Entity phoneCallEntity = new Entity("phonecall");

phoneCallEntity["subject"] = "Test Subject";
phoneCallEntity["description"] = "Testing";

In between here i am not sure with syntax to create an activity party and add to phonecallentity object.

 activityId = resultService.Create(phoneCallEntity);

Please request to suggest me to achieve this.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Bindu,

    Here is your code . Hope this helps.

                       

    Entity From = new Entity("activityparty");
    
                       Entity TOContact1 = new Entity("activityparty");
    
                       Entity TOContact12 = new Entity("activityparty"); // two contacts inside the to field
    
                       From["partyid"] = new EntityReference("systemuser", userId); // Need to replace with Guid
    
                       TOContact1["partyid"] = new EntityReference("contact", contact1Id); // Need to replace with Guid
    
                       TOContact12["partyid"] = new EntityReference("contact", contact2Id); // optional  -Need to replace with Guid
    
                       Entity phoneCallEntity = new Entity("phonecall");
    
                       phoneCallEntity["subject"] = "Test Subject";
    
                       phoneCallEntity["description"] = "Testing";
    
                       phoneCallEntity["from"] = new Entity[] { From };
    
                       phoneCallEntity["to"] = new Entity[] { TOContact1, TOContact12 };
    
                       // other phonecall fields
    
                       Guid phonecallId = service.Create(phonecall);
  • Community Member Profile Picture
    on at

    Hi Goutam,

    Thanks for that snippet, by using contact id will this activity get linked to that particular contact?

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Bindu,

    Exactly you are correct this will be link to the contact.

  • Community Member Profile Picture
    on at

    Hi Goutam,

    I was able to create phone call activity from the above snippet.Thank you!

  • KCDeVoe Profile Picture
    1,450 on at

    Edit: My reply a different post ended up here. It won’t let me delete.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans