Monday, June 7, 2010

CRM 4.0 Assign CRM record to another user using CRM-SDK

Last week i have assigned a task to assign the record to another user in CRM. using CRM SDK ,we can assign the record to another user.


Program as follows




protected void AssignToUser(ref ICrmService crmService, String targetEntity, String NewOwnerGuid)

{

SecurityPrincipal assignee = new SecurityPrincipal();

assignee.Type = SecurityPrincipalType.User;



assignee.PrincipalId = new Guid(NewOwnerGuid);

TargetOwnedIncident target = new TargetOwnedIncident();



target.EntityId = new Guid(targetEntity);



AssignRequest assign = new AssignRequest();

assign.Assignee = assignee;

assign.Target = target;



AssignResponse assignResponse = (AssignResponse)crmService.Execute(assign);

}

No comments:

Post a Comment