Hello Community Members.
I have been working on dynamics 365 crm for a while and just trying to find out that is it possible to create custom fields in any entity using plugins?
Please if anyone ever thought of this and tried any methods and got successful please let me know.
Thank you
*This post is locked for comments
I have the same question (0)Hi Shubham
You should be able to create attributes from plugin using CreateAttributeRequest.
An example of creating a Two Options field
// Create a boolean attribute
BooleanAttributeMetadata boolAttribute = new BooleanAttributeMetadata
{
// Set base properties
SchemaName = "new_boolean",
DisplayName = new Label("Sample Boolean", _languageCode),
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
Description = new Label("Boolean Attribute", _languageCode),
// Set extended properties
OptionSet = new BooleanOptionSetMetadata(
new OptionMetadata(new Label("True", _languageCode), 1),
new OptionMetadata(new Label("False", _languageCode), 0)
)
};
// Create the request.
CreateAttributeRequest createAttributeRequest = new CreateAttributeRequest
{
EntityName = Contact.EntityLogicalName,
Attribute = boolAttribute
};
// Execute the request.
_serviceProxy.Execute(createAttributeRequest);
Please follow the link below to see examples for other types
docs.microsoft.com/.../gg327577(v%3Dcrm.8)
More useful links
docs.microsoft.com/.../create-custom-entity
Community Member
2
Christoph Pock
1