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);

Comments

Popular posts from this blog

Basic Plugin Code in D365 using C#

CURD (Create, Update, Retrieve and Delete) Operation in D365 using Power Shell Script

Meta Data Using WebApiRequest