Posted in CRM, Plugin

Custom Entity creation through C#

CreateEntityRequest createrequest = new CreateEntityRequest
 {
 Entity = new EntityMetadata
 {
 SchemaName = "new_rakesh",
 DisplayName = new Label("rakeshs", 1033),
 DisplayCollectionName = new Label("rakeshs", 1033),
 Description = new Label("An entity to store information custom customer bank accounts", 1033),
 OwnershipType = OwnershipTypes.UserOwned,
 IsActivity = false,
 },
 PrimaryAttribute = new StringAttributeMetadata
 {
 SchemaName = "new_names",
 RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
 MaxLength = 100,
 FormatName = StringFormatName.Text,
 DisplayName = new Label("Names", 1033),
 Description = new Label("The primary attribute for the Custom entity.", 1033)
 },
 };
 service.Execute(createrequest);