The Question: How to cancel a Case (Incident) in Microsoft CRM 4 using the WebService?
I'm writing this because it took me ages to find the right answer and M$'s documentation is useless, hopefully this will save time for other people.
The Question: How to cancel a Case (Incident) in Microsoft CRM 4 using the WebService?
I'm writing this because it took me ages to find the right answer and M$'s documentation is useless, hopefully this will save time for other people.
The Answer (in VB.NET):
Dim CancelRequest As New SetStateIncidentRequest
CancelRequest.IncidentState = IncidentState.Canceled
CancelRequest.IncidentStatus = -1
CancelRequest.EntityId = // [GUID OF INCIDENT]
Dim CancelResponse As New SetStateIncidentResponse
Try
CancelResponse = objCrm.Execute(CancelRequest)
Catch ex As System.Web.Services.Protocols.SoapException
Dim root As XmlElement = ex.Detail
strErrors = strErrors & vbCrLf & vbCrLf & root.ChildNodes(0).ChildNodes(3).InnerText
Return False
Catch ex As Exception
strErrors = strErrors & vbCrLf & vbCrLf & ex.Message
Return False
End Try
Return True
Where objCRM is an instance of the CrmService.