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