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