Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

The Opportunity can not be closed error

$
0
0

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


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>