web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Creating Custom Fields using Plugin.

(0) ShareShare
ReportReport
Posted on by 10

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)
  • Verified answer
    Kokulan Profile Picture
    18,054 on at
    RE: Creating Custom Fields using Plugin.

    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

    stackoverflow.com/.../crm-create-field-programmatically

    stackoverflow.com/.../programmatically-create-an-attribute-map-for-custom-fields-on-the-lead-contact-e

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans