e_sezgin
e_sezgin

Reputation: 63

CRM C# Close Quote Request : "An unexpected error occurred."

I need to close the quote in a plugin and I am sure that the quote's status(statecode) is active(not draft).I am using Close Quote Request Message as shown below.

        CloseQuoteRequest closeQuoteRequest = new CloseQuoteRequest()
        {
             QuoteClose=quote,
             Status=new OptionSetValue(5)
        };

       service.Execute(closeQuoteRequest);

When i execute the request, it throws error message:'An unexpected error occurred'. Then I found another approach but in that approach, I cant use CloseQuote class under Crm.Sdk.Messages namespace.

 CloseQuoteRequest closeQuoteRequest = new CloseQuoteRequest()
 {
    QuoteClose = new QuoteClose()
    {
       QuoteId = closeQuote.ToEntityReference(),
       Subject = "Accepted " + DateTime.Now.ToString()
    },

   Status = new OptionSetValue(5),
  }; 

How can I use QuoteClose class or what's wrong with first code block that cause an error?

Upvotes: 1

Views: 3877

Answers (1)

Andrew Butenko
Andrew Butenko

Reputation: 5446

As far as I understood in first code part you were passing quote entity instance to QuoteClose parameter of Request. This is wrong because you have to pass QuoteClose entity instance. Recheck following article - http://mileyja.blogspot.com/2011/08/close-quote-using-jscript-or-net-in.html

Upvotes: 1

Related Questions