通过 Web 服务解决 CRM4 中的事件(结案)?

发布于 2024-08-16 16:42:51 字数 277 浏览 6 评论 0原文

我正在尝试通过 Web 服务解决/关闭 Dynamics CRM4 案例/事件。

单个 SetStateIncidentRequest 是不够的,它会返回 服务器无法处理请求 错误消息。我认为这与触发案例属性更改的活动工作流程有关。我不知道是否还有其他因素阻止请求工作。

由于可以通过 GUI 关闭这些案例,我想需要遵循一组“正确”的步骤才能通过 CrmService 实现它;不幸的是,我已经用谷歌搜索了一段时间,但没有找到我想要的东西。有人可以帮我吗?

I'm trying to resolve/close Dynamics CRM4 cases/incidents through webservices.

A single SetStateIncidentRequest is not enough and returns a Server was unable to process request error message. I think it has something to do with active workflows that trigger on case's attribute changes. I don't know if there's anything else preventing the request to work.

Since it is possible to close those cases through the GUI, I guess there's a "correct" set of steps to follow in order to achieve it through CrmService; unfortunately, I've been googleing it for a while without finding what I want. Could anybody help me, please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

把人绕傻吧 2024-08-23 16:42:51

为了解决 CRM 中的案例(在 VB.NET 中),我执行以下操作:

Try

Dim activity As New incidentresolution
Dim closeRequest As New CloseIncidentRequest
Dim closeResponse As New CloseIncidentResponse
Dim strErrors As String = String.Empty()

activity.incidentid = New Lookup
activity.incidentid.type = EntityName.incident.ToString
activity.incidentid.Value = //[GUID OF INCIDENT]

activity.ownerid = New Owner
activity.ownerid.type = EntityName.systemuser.ToString
activity.ownerid.Value = //[GUID OF USER PERFORMING ACTION]

activity.statecode = New IncidentResolutionStateInfo
activity.statecode.Value = 1 //Resolved

activity.statuscode = New Status
activity.statuscode.Value = 5 //Problem Solved

closeRequest.IncidentResolution = activity
closeRequest.Status = 5 //Problem Solved

// IF REQUIRED:
activity.timespent = New CrmNumber
activity.timespent.Value = //[INTEGER REPRESENTING No. OF MIN SPENT ON CASE]

closeResponse = objCrm.Execute(closeRequest)

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

End Try

To resolve a case in CRM (in VB.NET), I do the following:

Try

Dim activity As New incidentresolution
Dim closeRequest As New CloseIncidentRequest
Dim closeResponse As New CloseIncidentResponse
Dim strErrors As String = String.Empty()

activity.incidentid = New Lookup
activity.incidentid.type = EntityName.incident.ToString
activity.incidentid.Value = //[GUID OF INCIDENT]

activity.ownerid = New Owner
activity.ownerid.type = EntityName.systemuser.ToString
activity.ownerid.Value = //[GUID OF USER PERFORMING ACTION]

activity.statecode = New IncidentResolutionStateInfo
activity.statecode.Value = 1 //Resolved

activity.statuscode = New Status
activity.statuscode.Value = 5 //Problem Solved

closeRequest.IncidentResolution = activity
closeRequest.Status = 5 //Problem Solved

// IF REQUIRED:
activity.timespent = New CrmNumber
activity.timespent.Value = //[INTEGER REPRESENTING No. OF MIN SPENT ON CASE]

closeResponse = objCrm.Execute(closeRequest)

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

End Try
怪我闹别瞎闹 2024-08-23 16:42:51

这里有一个提示 - 捕获 SoapException 并检查 Detail.OuterXML 属性,您将获得更详细的错误消息。您可能没有正确构建您的请求。

Here's a tip - catch the SoapException and examine the Detail.OuterXML property and you will get a more detailed error message. It's possible you're not building your request correctly.

天暗了我发光 2024-08-23 16:42:51

事实上,我不知道存在一个与 CrmService.Execute() 方法一起使用的 CloseIncidentRequest 类。 SetStateIncidentRequeset 很可能不起作用,因为预计事件解决方案是这样创建的。遗憾的是,类和操作的名称没有一致使用(案例/事件、解决方案/结束)...

Indeed, I didn't know that there exists a CloseIncidentRequest class to use with the CrmService.Execute() method. Most probably the SetStateIncidentRequeset won't work because it's expected that incident resolutions are created that way. Pity that names for classes and actions aren't used consistently (case/incident, resolution/closing)...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文