Thursday, March 29, 2012

Add a Custom Attribute to an Entity in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration will show you how to add a new custom attribute to an entity in Microsoft Dynamics CRM 2011 using VB.NET.

Ok, here is what the code looks like once your service is instantiated!


Dim attribute As New StringAttributeMetadata
attribute.SchemaName = "new_stringattribute"
attribute.DisplayName = New Label("sample string  attribute", 1033)
attribute.RequiredLevel = New AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None)
attribute.Description = New Label("string attribute", 1033)
attribute.MaxLength = 100

Dim req As New CreateAttributeRequest
req.EntityName = "account"
req.Attribute = attribute
Dim resp As CreateAttributeResponse = DirectCast(service.Execute(req), CreateAttributeResponse)

Thats all there is to it!

1 comment:

  1. This is a good article & good site.Thank you for sharing this article. It is help us following categorize:
    healthcare, e commerce, programming, multi platform,inventory management, cloud-based solutions, it consulting, retail, manufacturing, CRM, technology means, digital supply chain management, Delivering high-quality service for your business applications,
    Solutions for all Industries,
    Getting your applications talking is the key to better business processes,
    Rapid web services solutions for real business problems,
    Web-based Corporate Document Management System,
    Outsourcing Solution,
    Financial and Operations Business Intelligence Solution,

    Our address:
    2002 Timberloch Place, Suite 200
    The Woodlands, TX 77380