Assign Requests in Silverlight MS CRM SOAP Endpoint

While working with SOAP Endpoint in MS CRM and Silver light, there would occur scenarios in which you would need to assign a particular entity record to a different user.

To know more on Assign Request, check the post here.

With SOAP, we can execute an AssignRequest like this :

public void assignDoctor(string guidLeadId, string guidDoctorId)
        {
			OrganizationRequest request = new OrganizationRequest() { RequestName = "Assign" };
			request["Target"] = new CrmSdk.EntityReference() { Id = new Guid(guidLeadId), LogicalName = "lead" };
			request["Assignee"] = new CrmSdk.EntityReference() { Id = new Guid(guidDoctorId), LogicalName = "systemuser" };
			IOrganizationService service = SilverlightUtility.GetSoapService();
			service.BeginExecute(request, new AsyncCallback(assignDoctor_Handler), service);
			Dispatcher.BeginInvoke(() =>
			{
				//Do UI operations here
			});
        }

 public void assignDoctor_Handler(IAsyncResult result)
        {
            try
            {
                OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result);
            }
            catch (Exception ex)
            {
                //Do somethng here;
            }
        }

The AssignRequest using JScript could be found in this post here.

Happy Coding!

Advertisements

About mytechlifedays

Its been a wonderful learning period over the last 6 years in the IT industry , getting exposed to whole lot of technologies and ideas. The hurdles and the crisis that came along have been wonderful experience ... And now its time to pen them down so that let some others execute faster and easily with these information .....
This entry was posted in MS CRM, Silverlight and tagged , , . Bookmark the permalink.

Leave a Reply ! It would be always appreciated ! :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s