Reputation: 81
When using the Microsoft Dynamics CRM Online 2016 OData API, I ran into a problem creating a task/phonecall with statecode equal to completed.
Problem Description:
create a phone call entity with statecode=1 (Completed) statuscode=2 (Made) same idea with task (constants defined here)
API returns an internal server error saying that:
2 is not a valid status code for state code PhoneCallState.Open on phonecall with Id cfdb5757-3666-e611-80fa-3863bb2ed1f8.
Dynamics server ignored the PhoneCallState.Completed (statecode = 1) parameter that I passed to it. For now, the workaround is to make a separate PATCH request to update the statecode and statuscode.
Is there a way to create a task/phonecall with completed state in one request?
Upvotes: 3
Views: 1183
Reputation: 18895
I believe that James's answer is correct. If you truly wanted to perform a single create, and create it as Completed, you could add two new fields to the Entity (PostCreateStatus, PostCreateState) and then create a Post Create Plugin that updates the status and state. This would be result in a single call to the server, creating the entity with the desired states and statuses.
Upvotes: 2
Reputation: 17562
I don't believe you can create a record in a completed status (statecode
). So you will need to do a create call followed by an update or set state, I think that is just the way CRM works.
Upvotes: 2