Closing an opportunity Programmatically

Entity opptyCloseObj = new Entity("opportunityclose");

opptyCloseObj.Attributes.Add("opportunityid", new EntityReference("opportunity", OpptyID)); opptyCloseObj.Attributes.Add("actualend", DateTime.Now);
opptyCloseObj.Attributes.Add("actualrevenue", ActualopptyAmount);

 var lostOpportunity = new LoseOpportunityRequest
      OpportunityClose = opptyCloseObj,
      Status = new OptionSetValue(MIGRATED_STATUS_CODE) // Expired


Popular posts from this blog

Workflow Activity Input and Output Parameters and Data Types in MS CRM 2013/15/16

Get Workflow Guid in Javascript using OData query

Convert Plugin to Sandbox mode,