Posts

Showing posts from November, 2017

Change the Status using SetStateRequest in c# mscrm

   SetStateRequest state = new SetStateRequest();                                                     state.EntityMoniker = new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId);                                                     state.State = new OptionSetValue(0);//(0);//0=active                                                     state.Status = new OptionSetValue(StatusCode);//(621260000);//=cancelled;//(1)=active                                                     // Point the Request to the case whose state is being changed                                                     // Execute the Request                                                     _tracing.Trace("state.State" + state.State + "state.Status " + state.Status);                                                     SetStateResponse stateSet = (SetStateResponse)_service.Execute(state);

using entity Name we can set plural name Manually in MS CRM

   var result = ename.slice(-1);     if (result == "s") {         result = ename + "es";     } else if (result == "y") {         result = ename.replace(entName.slice(-1), "ies");     } else {         result = ename + "s";     }

customer lookup using Web Api Request

field Schema Name = apy_CustomerId if (entityName.toLowerCase() == "account") {     entity["apy_CustomerId_account@odata.bind"] = "/accounts(" + entId + ")"; } else if (entityName.toLowerCase() == "contact") {     entity["apy_CustomerId_contact@odata.bind"] = "/contacts(" + entId + ")"; }