locked
Activate and Close Quote via Late Bound RRS feed

  • Question

  • I need to use late bound code to activate and then close a quote.  The following is Early Bound code to accomplish this but can anyone translate it into Late Bound code?

    public void CloseQuote(IOrganizationService service, Quote closeQuote)
    {
    //Activate the Quote
    SetStateRequest activateQuote = new SetStateRequest()
    {
    EntityMoniker = closeQuote.ToEntityReference(),
    State = new OptionSetValue((int)QuoteState.Active),
    Status = new OptionSetValue((int)quote_statuscode.InProgress_2)
    };
    service.Execute(activateQuote);

    //Close the Quote
    CloseQuoteRequest closeQuoteRequest = new CloseQuoteRequest()
    {
    QuoteClose = new QuoteClose()
    {
    QuoteId = closeQuote.ToEntityReference(),
    Subject = “Accepted ” + DateTime.Now.ToString()
    },
    Status = new OptionSetValue((int)quote_statuscode.Accepted),
    };
    service.Execute(closeQuoteRequest);
    }

    Sunday, September 1, 2013 10:51 AM

Answers

All replies

  • Hi,

    Please refer to following link to execute activateQuoteRequest and closeQuoteRequest

    http://vikramxrm.blogspot.com/2013/04/re-open-lost-opportunity-in-ms-crm-2011.html

    and refer following link to check the status values

    http://msdn.microsoft.com/en-us/library/gg594435.aspx


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    • Proposed as answer by HIMBAPModerator Monday, September 2, 2013 7:12 AM
    • Marked as answer by DarinBrowne Monday, September 2, 2013 10:35 AM
    Sunday, September 1, 2013 2:33 PM
  • _Vikram - your link uses the SetStateRequest - you don't use that when closing quotes; you'll need to create a closequote entity instance.

    Here's an example:

    // Late bound CloseQuoteRequest
    Entity quoteClose = new Entity("quoteclose");
    quoteClose["subject"] = _subject;
    quoteClose["quoteid"] = _record;
    CloseQuoteRequest closeQuoteRequest = new CloseQuoteRequest()
                        {
                            QuoteClose = quoteClose,
                            Status = _statuscode
                        };
                        _serviceProxyT.Execute(closeQuoteRequest);


    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful. Michael Mayo

    Wednesday, January 28, 2015 9:51 AM