通过 SOAP Web 服务创建服务预约实体时,我收到关于状态码和状态码不匹配的错误:
4 不是状态代码 ServiceAppointmentState.Open on serviceappointment 的有效状态代码。
本质上说reserved (statuscode 4)不是Open state (statecode 1)的成员。没错,它实际上是计划状态(状态代码 3)的成员,但在我的请求中,我正确地将状态代码设置为 3!
有谁知道为什么我将 serviceappointment 设置为 Scheduled 状态被忽略?
完整请求:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<entity xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Attributes xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>statecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>3</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>serviceid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>c5b8179c-3cab-e211-ab0a-00155d1438e9</a:Id>
<a:LogicalName>service</a:LogicalName>
<a:Name i:nil="true" />
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>scheduledend</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2013-06-13T14:30:00</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>statuscode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>4</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>subject</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">Support handover</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>scheduledstart</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2013-06-13T09:00:00</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>py3_workpackageid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>dc7008cf-2eab-e211-ab0a-00155d1438e9</a:Id>
<a:LogicalName>py3_workpackage</a:LogicalName>
<a:Name i:nil="true" />
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>customers</b:key>
<b:value i:type="a:EntityCollection">
<a:Entities>
<a:Entity>
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>partyid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>050d25a8-03c9-e211-866e-00155d143602</a:Id>
<a:LogicalName>account</a:LogicalName>
<a:Name i:nil="true" />
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>activityparty</a:LogicalName>
<a:RelatedEntities />
</a:Entity>
</a:Entities>
<a:EntityName i:nil="true" />
<a:MinActiveRowVersion i:nil="true" />
<a:MoreRecords>false</a:MoreRecords>
<a:PagingCookie i:nil="true" />
<a:TotalRecordCount>0</a:TotalRecordCount>
<a:TotalRecordCountLimitExceeded>false</a:TotalRecordCountLimitExceeded>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>resources</b:key>
<b:value i:type="a:EntityCollection">
<a:Entities>
<a:Entity>
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>partyid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>3e17fce0-e9cd-e211-866e-00155d143602</a:Id>
<a:LogicalName>systemuser</a:LogicalName>
<a:Name i:nil="true" />
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>activityparty</a:LogicalName>
<a:RelatedEntities />
</a:Entity>
</a:Entities>
<a:EntityName i:nil="true" />
<a:MinActiveRowVersion i:nil="true" />
<a:MoreRecords>false</a:MoreRecords>
<a:PagingCookie i:nil="true" />
<a:TotalRecordCount>0</a:TotalRecordCount>
<a:TotalRecordCountLimitExceeded>false</a:TotalRecordCountLimitExceeded>
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>serviceappointment</a:LogicalName>
<a:RelatedEntities xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
</entity>
</Create>
</soap:Body>
</soap:Envelope>
从组织中删除解决方案时似乎偶尔会发生相同的错误,因此我在研究该问题时遇到了麻烦。我发现的只是这个论坛帖子,但似乎没有解决。