This is the first blog in the series where we will play around with MetaData service in CRM 2011 and answer some of the questions for Adam. Today Adam wants to know how to create an entity using the SDK or metadata service. Here is how we can do that.
We will use the CreateEntityRequest Message with Execute method of Organization service to create the entity. CreateEntityRequest has a member “Entity” that takes in the new entity to be created.
CreateEntityRequest request = new CreateEntityRequest
Entity = new EntityMetadata
SchemaName = entity.SchemaName,
DisplayName = new Label(“Adam”, “1033”),
DisplayCollectionName = new Label(“Humans”, “1033”),
LogicalName = “new_Adam”
In the next blog we will add attributes to entities.