Asked by:
Set quote states by code

Question
-
Hi
I use a code like this to save quotes programatically in my web service :
Entity qoute = new Entity("quote");
qoute["name"] = quotation.Name;
qoute["customerid"] = new EntityReference(....) ;
qoute["ownerid"] = new EntityReference("systemuser",....);
var qouteId = serviceProxy.Create(qoute);
After saving the quote, according to a field which user sends through web service, I want to change the quote status to one of these types:
1. Set it as won and also fill fields we can see in the following image
2. Set it as closed and fill the fields you can see in the following image:
in this state, I want "Do not revise this quote" marked and set status reason to "Closed"
But I dont know how I can do this with code. I also read something about WinQuoteRequest but cant find it although I have CRM entities code in my project.
Would you help me please ?
Saturday, February 1, 2014 3:03 PM
All replies
-
Hi,
Check following MSDN article. It has sample for the same:
http://msdn.microsoft.com/en-us/library/gg309346.aspx
Hope this helps.
-----------------------------------------------------------------------
Minal Dahiya
blog : http://minaldahiya.blogspot.com.au/
If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"- Proposed as answer by Minal Dahiya Sunday, February 2, 2014 10:49 AM
Sunday, February 2, 2014 10:48 AM -
Hi Minal
I read the example. But I cant understand a few things. For example, when I want to use the following code
activateQuote = new SetStateRequest() { EntityMoniker = quote.ToEntityReference(), State = new OptionSetValue((int)QuoteState.Active), Status = new OptionSetValue((int)quote_statuscode.InProgress) };
it throws "The name 'quote_statuscode' does not exist in the current context..."
Sunday, February 2, 2014 1:11 PM -
Hi,
The error could be because you are not using early binding in your code. Here is couple of articles which explains how to set this up.
http://msdn.microsoft.com/en-us/library/gg328499.aspx
http://msdn.microsoft.com/en-us/library/gg334754.aspx
Here is how to generate early bound classes.
http://msdn.microsoft.com/en-us/library/gg327844.aspx
Alternatively you have issue with InProgress not a valid state in the CRM instance.
Hope this helps.
-----------------------------------------------------------------------
Minal Dahiya
blog : http://minaldahiya.blogspot.com.au/
If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"- Edited by Minal Dahiya Monday, February 3, 2014 3:53 AM Added more context
Monday, February 3, 2014 12:27 AM