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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Create a New Entity in Microsoft Dynamics CRM 2011 Using VB.NET

Jamie Miley Profile Picture Jamie Miley 2,060
This illustration will show you how to create a new entity in Microsoft Dynamics CRM 2011 using VB.NET to invoke CreateEntityRequest.

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

In VB.NET

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 entity As New EntityMetadata
entity.SchemaName = "new_vbtest"
entity.DisplayName = New Label("vbtest", 1033)
entity.DisplayCollectionName = New Label("new vbtest entity", 1033)
entity.Description = New Label("our spiffy new entity we made in vb.net that doesn't really do anything", 1033)
entity.OwnershipType = OwnershipTypes.OrganizationOwned
entity.IsActivity = False

Dim req As New CreateEntityRequest
req.Entity = entity
req.PrimaryAttribute = attribute
Dim resp As CreateEntityResponse = DirectCast(service.Execute(req), CreateEntityResponse)


Thats all there is to it!
-



This was originally posted here.

Comments

*This post is locked for comments