Hi,
In the case of closing quotes, use the CloseQuoteRequest message instead.
The main reason that you want to use this message over the
SetStateQuoteRequest is that when a quote is closed, a CloseQuote activity
gets created automatically. The CloseQuoteRequest message allows the
developer to create that activity where the SetStateQuoteRequest message
does not. The Microsoft CRM platform will not allow you to close the quote
without the activity which is why you saw the error in your code.
SetStateQuoteRequest is mainly used to activate a quote. Here is some
sample code that I have used in the past to close quotes using the
CloseQuoteRequest message.
try
{
Guid ID = new Guid("4DBA9FC0-E535-DA11-A02D-000874DE7397"); //Guid of
quote being closed.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
quoteclose quoteclose = new quoteclose();
quoteclose.quoteid = new Lookup();
quoteclose.quoteid.type=EntityName.quote.ToString();
quoteclose.quoteid.value = ID;
quoteclose.subject = "Close Quote";
CloseQuoteRequest req = new CloseQuoteRequest();
req.QuoteClose = quoteclose;
req.Status = -1;
CloseQuoteResponse response = (CloseQuoteResponse) service.Execute(req);
}
catch (System.Web.Services.Protocols.SoapException err)
{
string strErrorMsg = String.Concat("Error Message: ", err.Message," ",
err.Detail.OuterXml,"Source: ",err.Source);
}
Thanks,
Jonathan Randall
Microsoft Online Support Engineer - MBS CRM Developer Support
Get Secure! - www.microsoft.com/security
=============================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Closing a quote automatically
thread-index: AcYoRDdInvEy1p28R8+NpJmuzjI7rw==
X-WBNR-Posting-Host: 66.166.163.242
From: "=?Utf-8?B?TWljaGFlbCBHbGFzcw==?=" <***@newsgroups.nospam>
Subject: Closing a quote automatically
Date: Thu, 2 Feb 2006 14:01:27 -0800
Lines: 9
Message-ID: <AFC8FE3B-218C-4675-B3A0-***@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.crm.developer
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.crm.developer:7787
X-Tomcat-NG: microsoft.public.crm.developer
I'm trying to close a quote entity through the web service automatically. I
have the quote I want to close in a quote object. I create a
SetStateQuoteRequest object, give it the EntityId of the quote, give it the
QuoteState (QuoteState.Closed), give it QuoteStatus = -1, and try to
execute,
and it fails. The error it gives me is "An unexpected error occurred."
which
is of course completely useless. I've looked into the QuoteClose entity as
well, but there is no documentation beyond listing the attributes, so I
don't
know where to go with it. Any help is appreciated. Thanks!