This illustration shows how to create an option set in Microsoft Dynamics CRM 2011 using VB.NET with the CreateOptionSet Request. This example will be given in VB.NET.
Ok, here is what the code look like!
Ok, here is what the code look like!
In VB.NET:
Dim req As New CreateOptionSetRequest()
Dim omd As New OptionSetMetadata()
omd.Name = "new_optionsettest"
omd.DisplayName = New Label("Example Option Set", 1033)
omd.IsGlobal = True
omd.OptionSetType = OptionSetType.Picklist
omd.Options.Add(New OptionMetadata(New Label("Green", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Yellow", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Blue", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Brown", 1033), Nothing))
req.OptionSet = omd
Dim resp As CreateOptionSetResponse = DirectCast(service.Execute(req), CreateOptionSetResponse)
I hope this helps!
-
-
No comments:
Post a Comment