CrmServiceClient.CloseOpportunity Method (Guid, Dictionary<String, CrmDataTypeWrapper>, Int32, Guid)


Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

This will close an opportunity as either Won or lost in CRM

Namespace:   Microsoft.Xrm.Tooling.Connector
Assembly:  Microsoft.Xrm.Tooling.Connector (in Microsoft.Xrm.Tooling.Connector.dll)


public Guid CloseOpportunity(
    Guid opportunityId,
    Dictionary<string, CrmDataTypeWrapper> fieldList,
    int opportunityStatusCode = 3,
    Guid batchId = null
Public Function CloseOpportunity (
    opportunityId As Guid,
    fieldList As Dictionary(Of String, CrmDataTypeWrapper),
    opportunityStatusCode As Integer,
    batchId As Guid
) As Guid


  • opportunityId
    Type: System.Guid

    ID of the opportunity to close

  • opportunityStatusCode
    Type: System.Int32

    Status code of Opportunity, Should be either 1 or 2, defaults to 1 ( won )

  • batchId
    Type: System.Guid

    Optional: if set to a valid GUID, generated by the Create Batch Request Method, will assigned the request to the batch for later execution, on fail, runs the request immediately

Return Value

Type: System.Guid

See Also

CrmServiceClient Class
Microsoft.Xrm.Tooling.Connector Namespace

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright