Creating an activity through the CRM WebApi

Recentely I had to create a phonecall activity through the WebApi in Dynamics 365 CRM. As most WebApi calls are pretty straight forward, I didn’t think much of this task, although I haven’t done this before. As I knew activities are special in CRM I looked around to see examples and couldn’t find any good ones. Therefore I’m writing this post, to make sure I have an example on hand when I need one.

Endpoint

To create an activity you use the relevant endpoint. These are /api/data/v8.2/phonecalls, /api/data/v8.2/emails, ect. Maybe there’s an option to use the generic endpoint, but I haven’t tested this.

Json message

For a phonecall the Json message could look like this:

The special part in this are the activity parties. More special even, that it’s called phonecall_activity_parties. That array contains two objects with a navigation lookup to the record and a participationtypemask. The number in the participationtypemask stands for From (1) and To (2).

Leave a Reply

Your email address will not be published. Required fields are marked *