Answered by:
assign owner

Question
-
Hi
in crm2011 using silverlight trying to assign owner to entity
this code executes without any errors and no assignment has taken place.
IOrganizationService orgService = SilverlightUtility.GetSoapService(); //test Guid ownerid =new Guid("{591a76ef-c24e-e011-9185-00155d0baa0f}"); OrganizationRequest request = new OrganizationRequest() { RequestName = "Assign" }; request["target"] = new EntityReference() { Id = pj.JobId, LogicalName = "abc" }; request["assignee"] = new EntityReference() { Id = ownerid, LogicalName = "systemuser" }; orgService.BeginExecute(request, new AsyncCallback(test1), orgService);
any suggestions on why this entity isnt assigned to new owner
thanks in advance
jason
Friday, April 1, 2011 4:45 AM
Answers
-
ok figured it out.
heres the code
in the callback I needed to include OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result); to complete the assignment.private void AssignNewOwner() { OrganizationRequest request = new OrganizationRequest() { RequestName = "Assign" }; request["Target"] = new CrmSdk.EntityReference() { Id = JobId, LogicalName = "abc" }; request["Assignee"] = new CrmSdk.EntityReference() { Id = ownerid, LogicalName = "systemuser" }; orgService.BeginExecute(request, new AsyncCallback(Assign_Complete), orgService); } } catch (Exception ex) { messagebox("hjhjhjfsfs"); } } private void Assign_Complete(IAsyncResult result) { try { OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result); } catch (Exception ex) { messagebox("sfsfs"); } }
jason
- Marked as answer by Jasonkm Monday, April 4, 2011 12:07 AM
Monday, April 4, 2011 12:06 AM
All replies
-
Hi Jason,
Assigning record by directly changing owner won't work in CRM 4.0, I think same is happening here also.
Please try using AssignRequest.
Thanks and Regards
Ramu
- Proposed as answer by Janu_m Friday, April 1, 2011 5:04 AM
Friday, April 1, 2011 4:58 AM -
Thanks for reply
I'm using the OrganizationServiceContextExtensions.Assign Method which is the equivalent AssignRequest method based on what I read in the sdk documentation.
The code executes but not sure how to get the assign response?
jason
Friday, April 1, 2011 5:17 AM -
jason ,
as janu_m suggested you have to use the AssignRequest to achieve the same.
// Create the Request Object and Set the Request Object's Properties
AssignRequest assign = new AssignRequest
{
Assignee = new EntityReference(SystemUser.EntityLogicalName,
_otherUserId),
Target = new EntityReference(Account.EntityLogicalName,
_accountId)
};
// Execute the Request
_service.Execute(assign);
vishal swami http://msdynamics4you.blogspot.com/- Proposed as answer by VishalSwamiMicrosoft employee Friday, April 1, 2011 5:51 AM
Friday, April 1, 2011 5:50 AM -
thanks for suggestion
in crm2011 for SOAP Endpoint with Silverlight I dont see any AssignRequest method.
Sunday, April 3, 2011 11:03 PM -
ok figured it out.
heres the code
in the callback I needed to include OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result); to complete the assignment.private void AssignNewOwner() { OrganizationRequest request = new OrganizationRequest() { RequestName = "Assign" }; request["Target"] = new CrmSdk.EntityReference() { Id = JobId, LogicalName = "abc" }; request["Assignee"] = new CrmSdk.EntityReference() { Id = ownerid, LogicalName = "systemuser" }; orgService.BeginExecute(request, new AsyncCallback(Assign_Complete), orgService); } } catch (Exception ex) { messagebox("hjhjhjfsfs"); } } private void Assign_Complete(IAsyncResult result) { try { OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result); } catch (Exception ex) { messagebox("sfsfs"); } }
jason
- Marked as answer by Jasonkm Monday, April 4, 2011 12:07 AM
Monday, April 4, 2011 12:06 AM