locked
Changing Opportunity status reason RRS feed

  • Question

  • Hi all,

     

    I have an opportunity that's already in "Won" status.. I want to change its status reason to my customs one with value "200013" which I've added to the list of statuses in Win.

     

    My code follows, but this returns an error "0x80040515 The opportunity is already closed. Platform".

     

    //Opportunity is already in "Win" state

    //Modify this opportunity status to "Cancellation in Progress", leaving it as "Win"

    opportunityclose oppclose = new opportunityclose();

    oppclose.opportunityid = new Lookup();

    oppclose.opportunityid.type = EntityName.opportunity.ToString();

    oppclose.opportunityid.Value = id;

    WinOpportunityRequest woReq = new WinOpportunityRequest();

    woReq.OpportunityClose = oppclose;

    woReq.Status = 200013;

    WinOpportunityResponse woResp = oService.Execute(woReq) as WinOpportunityResponse;

     

    I also tried openning the existing opportunityclose record with the given opportunity ID, but I get the same error...

     

    Can anyone help?

     

     

    thanks

     

    Wednesday, October 29, 2008 11:56 PM

Answers

  • I don't think this can work as you're trying it. You'll have to reopen the opportunity first, then your code should work. One reason for this is that a Won oppportunity is not editable

     

    Thursday, October 30, 2008 7:30 AM
    Moderator

All replies

  • Hi Sin,

    Please try without the

    '
    woReq.OpportunityClose = oppclose;' line.

    Cheers,

    Karlo
    Thursday, October 30, 2008 6:50 AM
  • I don't think this can work as you're trying it. You'll have to reopen the opportunity first, then your code should work. One reason for this is that a Won oppportunity is not editable

     

    Thursday, October 30, 2008 7:30 AM
    Moderator
  • thanks, that's what I'd suspected, but this will be an issue. We have a mass load of workflows and plugins on the open and close events.

     

    Though interestingly, I'm able to modify attribute values on the closed opportunity using the webservice.

    Thursday, October 30, 2008 1:04 PM