Sunday, April 15, 2012

Assign an Entity to a User in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows you how to assign an entity to a user using VB.NET with the Assign Request message against the CRM 2011 organization service.
VB.NET:

Dim req As New AssignRequest()
'entity you want to assign
'used string for entity logical name to show that this would work for a custom entity easily by specifying schema name for entity
req.Target = New EntityReference("account", New Guid("73800742-6C87-E111-9A1E-78E7D162EE70"))
'Team or user you want to assign it to
req.Assignee = New EntityReference(SystemUser.EntityLogicalName, New Guid("9106AB02-0879-E111-BB66-78E7D162DEDB"))
service.Execute(req)



Thats all there is to it!

I hope this helps!

No comments:

Post a Comment