MS Dynamics 365- Close Quote from C# / Custom action

Ankaprasad
Posted by Ankaprasad under C# category on | Points: 40 | Views : 420
  string id = "d2b1ac82-b18a-ea11-a811-000d3a35bdc2";
int statusReason = 5;

// First activate quote
Entity party = new Entity("quote", new Guid(id));
party["statecode"] = new OptionSetValue(1); // status - Active
party["statuscode"] = new OptionSetValue(2); // status Reason - inprogress
service.Update(party);

// then close the quote
CloseQuoteRequest req = new CloseQuoteRequest();
Entity quoteClose = new Entity("quoteclose");
quoteClose.Attributes.Add("quoteid", new EntityReference("quote", new Guid(id)));
quoteClose.Attributes.Add("subject", "Customer was mean so we just closed it.");
req.QuoteClose = quoteClose;
req.RequestName = "CloseQuote";
OptionSetValue o = new OptionSetValue();
o.Value = statusReason;
req.Status = o;

CloseQuoteResponse resp = (CloseQuoteResponse)service.Execute(req);

Comments or Responses

Login to post response