Skip to Content

Change status of sale quotes to "lost"

Nov 24, 2017 at 05:38 PM


avatar image


Here is the scenario: There are multiple sales quotes attached to an opportunity. Upon creation of an external follow-up document, the status of all the other sale quotes is to be set to "lost" and the custom status of the opportunity to "Z0005".

I am currently struggling with changing the status of a sale quote to "Lost", the field status is read-only and I can't find any action to change the status of the quote.

I am also having trouble reaching the other quotes linked to that opportunity. I thought I could do something like

var quotes = this.OpportunityReference.GetFirst().Opportunity.CustomerQuote;

and then do a foreach on the var quotes, but no luck.

I also tried doing a query of quotes, then a foreach on the result in order to compare the OpportunityReference of the current BO with the ones from the answers like this:

var query = CustomerQuote.QueryByElements;
var selectionParams = query.CreateSelectionParams(); selectionParams.Add(query.ID.content, "I", "GT", "0");
var resultData = query.ExecuteDataOnly(selectionParams);

foreach(var quote in resultData) {
if(quote.OpportunityReference.GetFirst()== this.OpportunityReference.GetFirst()) {

// add the quote to an array


but apparently I can't access the OpportunityReference in the var quote.

I don't know what else to do. Can anyone tell me what I do wrong?
Thanks for any help.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers