locked
The Opportunity can not be closed error RRS feed

  • Question

  • Hi frnds,

       When i close or won my opportunity using plugin some times it closed. sometimes it showing error as "the opportunity can not be closed".I have mentioned my plugin code below.Can any one review and give me a solution.Thanx in advance.

    My plugin code is here:

     LoseOpportunityRequest LoseReq = new LoseOpportunityRequest();
                                            Entity opportunityClose = new Entity("opportunityclose");
                                            opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", OppId));
                                            opportunityClose.Attributes.Add("subject", "Opportunity allowed to lost");
                                            opportunityClose.Attributes.Add("actualend", DateTime.Now);
                                            if (LoseCompId != Guid.Empty)
                                            {
                                                opportunityClose.Attributes.Add("competitorid", new EntityReference("competitor", LoseCompId));
                                            }
                                            LoseReq.OpportunityClose = opportunityClose;
                                            LoseReq.RequestName = "LoseOpportunity";
                                            OptionSetValue val = new OptionSetValue();
                                            val.Value = 5;
                                            LoseReq.Status = val;
                                            LoseOpportunityResponse resp = (LoseOpportunityResponse)service.Execute(LoseReq);


    Arun Kumar G

    Thursday, November 28, 2013 11:30 AM

Answers

  • Hi.. I found and solved the case. The reason for this issue is i have quotes in draft status and after removing those my issue got solved. Thanks for your suggestions.

    Arun Kumar G

    • Marked as answer by Aronkumar Tuesday, December 3, 2013 1:44 PM
    Tuesday, December 3, 2013 1:44 PM

All replies

  • In which user context you are running your plugin. If it’s calling user, do that user have appropriate privilege to close the opportunity? If calling user is not
    require then make the running user context as admin user.<o:p></o:p>


    Thursday, November 28, 2013 11:56 AM
  • Hi Suresh,

    We running the plugin under admin user context only. I couldnt get any specific error notification for this issue. Can you suggest where can i find the error details. Many users using this environment and so i couldnt see utilize the trace files too. Please guide me any issue in our code or suggest any other code for this scenario.


    Arun Kumar G


    • Edited by Aronkumar Thursday, November 28, 2013 12:10 PM
    Thursday, November 28, 2013 12:09 PM
  • Hi Arun,

    Your code looks fine. Can you check your eventview and get the error or Once debug your code.

    Friday, November 29, 2013 6:14 AM
  • Hi.. I found and solved the case. The reason for this issue is i have quotes in draft status and after removing those my issue got solved. Thanks for your suggestions.

    Arun Kumar G

    • Marked as answer by Aronkumar Tuesday, December 3, 2013 1:44 PM
    Tuesday, December 3, 2013 1:44 PM