Wednesday, August 08, 2007

Inactivating custom entities in code

I am currently working with as a sub consultant for what I beleive is Swedens foremost MS CRM supplier, Cybernetics, and ran into some problems when trying to deactivate a custom entity using code. I was unable to find any documentation at all in the latest version of the SDK but after a little searching, I found that Jonas Deibe at Microsoft Sweden, had the solution. Please have a look if you want to know how to do it:
http://blogs.msdn.com/jonasd/archive/2007/04/04/setting-status-with-setstatedynamicentityrequest.aspx

I'll just give you some code my self:

SetStateDynamicEntityRequest req = new SetStateDynamicEntityRequest();
req.Entity = new Moniker();
req.Entity.Id = yfid;
req.Entity.Name = EntityName.cyb_yearlybusiness.ToString();
req.State = "inactive"; // = Deactivation
req.Status = -1;
service.Execute(req);

I have seen some very interesting "fake lookups" here at Cybernetics aswell, and I will soon be writing about how to create them.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se

No comments:

Post a Comment