POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

If you are working on creating or updating a dynamic entity in Microsoft Dynamics CRM and got stuck on properly setting the statuscode field please read further:

crm2011

Assigning value to the statuscode fields is not same as assigning any other fields programmatically. It needs a bit of trick. Statecode and statucode fields in CRM are tightly related and they go hand on hand.

Let us consider a setting like this:

StatuscodenameStatuscode
Open1
Done2
Canceled3
Scheduled4
statecodenameStatuscode
Open0
Completed1
Canceled2
Scheduled3

Let us set the statuscode of a dynamic entity say “new_smartappointment” to done. CRM does not allow us to just set the status code to “Done”. We also have to set the statecode to completed. To set these state code and status code we need to use SetStateDynamicEntityrequest class.

And here is how we do it:

Hope that helps some of you out there.

Happy CRM’ing!

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.