Hi,
Here is the code to close an Opportunity as Lost using the MS Dynamics CRM SDK.
In this example, I am using LoseOpportunityRequest to close an Opportunity as Lost.
public static void CloseOpportunityAsLose(IOrganizationService crmService, Guid guidOpportunityId)
{
LoseOpportunityRequest req = new LoseOpportunityRequest();
Entity opportunityClose = new Entity("opportunityclose");
opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", guidOpportunityId));
opportunityClose.Attributes.Add("subject", "Lost the Opportunity!");
req.OpportunityClose = opportunityClose;
OptionSetValue osvLostValue = new OptionSetValue();
osvLostValue.Value = 4;
req.Status = osvLostValue;
LoseOpportunityResponse resp = (LoseOpportunityResponse)crmService.Execute(req);
}
Hope this helps.
--
Happy CRM'ing
Here is the code to close an Opportunity as Lost using the MS Dynamics CRM SDK.
In this example, I am using LoseOpportunityRequest to close an Opportunity as Lost.
public static void CloseOpportunityAsLose(IOrganizationService crmService, Guid guidOpportunityId)
{
LoseOpportunityRequest req = new LoseOpportunityRequest();
Entity opportunityClose = new Entity("opportunityclose");
opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", guidOpportunityId));
opportunityClose.Attributes.Add("subject", "Lost the Opportunity!");
req.OpportunityClose = opportunityClose;
OptionSetValue osvLostValue = new OptionSetValue();
osvLostValue.Value = 4;
req.Status = osvLostValue;
LoseOpportunityResponse resp = (LoseOpportunityResponse)crmService.Execute(req);
}
Hope this helps.
--
Happy CRM'ing
Gopinath |
No comments:
Post a Comment