normally we can chage the statuscode and statecode in plugin if we are having the Target Entity in our hand , by just passing the statecode and statuscode value we can do it.
how if we want to do it by using other way, means the query request.
there is special request object to maintain the stauscodes...
the code is as follows...
// Create the Set State Request
SetStateRequest objSetStateRequest = new SetStateRequest();
// Add entity refrence for which you want to set the status
// In Entity refrence first paramter is Entity name and second paramter is ENtity Id
objSetStateRequest.EntityMoniker = new EntityReference("new_mycustomentity", new Guid("{DBEC8A94-9DA7-E011-AA34-C95682B33448}"));
// Set State Value (Entity statecode/status code field value)
objSetStateRequest.State = new OptionSetValue(0);
// Set Status value (Entity statuscode/status reason filed value)
objSetStateRequest.Status = new OptionSetValue(449930002);
// Pass request to CRM Service execute method
crmService.Execute(objSetStateRequest);
hope this helps....
thanks,
yes.sudhanshu
how if we want to do it by using other way, means the query request.
there is special request object to maintain the stauscodes...
the code is as follows...
// Create the Set State Request
SetStateRequest objSetStateRequest = new SetStateRequest();
// Add entity refrence for which you want to set the status
// In Entity refrence first paramter is Entity name and second paramter is ENtity Id
objSetStateRequest.EntityMoniker = new EntityReference("new_mycustomentity", new Guid("{DBEC8A94-9DA7-E011-AA34-C95682B33448}"));
// Set State Value (Entity statecode/status code field value)
objSetStateRequest.State = new OptionSetValue(0);
// Set Status value (Entity statuscode/status reason filed value)
objSetStateRequest.Status = new OptionSetValue(449930002);
// Pass request to CRM Service execute method
crmService.Execute(objSetStateRequest);
hope this helps....
thanks,
yes.sudhanshu
No comments:
Post a Comment