在这个问题上,我几乎在桌子上敲了几天。 我的创建帐户xml请求工作正常,但我的事件xml请求不起作用。
以下是其中的任何帮助,我们将不胜感激。
$accountsRequest = EntityUtils::getCreateCRMSoapHeader($CRMURL, $securityData).
'
<s:Body>
<Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>ownerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $ownerid . '</c:value>
<c:key>customerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $customerid . '</c:value>
<c:key>subjectid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $subjectid . '</c:value>
<c:key>title</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $title . '</c:value>
<c:key>new_surveyid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_id . '</c:value>
<c:key>new_leadsource</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_leadsource . '</c:value>
<c:key>new_forename</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_forename . '</c:value>
<c:key>new_surname</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_surname . '</c:value>
<c:key>new_company</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_company . '</c:value>
<c:key>new_email</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_email . '</c:value>
<c:key>new_phone</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_phone . '</c:value>
<c:key>new_datetravel</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_datetravel . '</c:value>
<c:key>new_drivername</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_drivername . '</c:value>
<c:key>new_punctuality_pickup</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_punctuality_pickup . '</c:value>
<c:key>new_punctuality_dropoff</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_punctuality_dropoff . '</c:value>
<c:key>new_interior</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_interior . '</c:value>
<c:key>new_exterior</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_exterior . '</c:value>
<c:key>new_courtesy</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_courtesy . '</c:value>
<c:key>new_appearance</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_appearance . '</c:value>
<c:key>new_comments</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_comments . '</c:value>
<c:key>new_survey_date</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_date . '</c:value>
<c:key>new_survey_score</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_score . '</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>incident</b:LogicalName>
<b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
</entity>
</Create>
</s:Body>
</s:Envelope>
';
答案 0 :(得分:0)
显然我没有发现任何错误,有效trace并查看crm动态正在启动哪个错误。可能是一个属性有拼写错误。
答案 1 :(得分:0)
这些是字符串吗?
<c:key>ownerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $ownerid . '</c:value>
<c:key>customerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $customerid . '</c:value>
如果我通过CRM SDK这样做,我将使用实体参考。
e.g。
Entity e = new Entity("incident");
e["customerid"] = new EntityReference("contact", contactId); //or "account", accountId
e["ownerid"] = new EntityReference("systemuser", userId);
service.Create(e);
答案 2 :(得分:0)
我回答了我自己的问题 - XML没有正确形成 - 主要是命名空间问题。还有CRM事件字段的几个类型问题。如果没有上面的提示器就不可能做到这一点,谢谢你们。下面的XML适用于将来陷入困境的任何人。
顾客ID 6caff60a-f77c-E211-b2fb-d48564518ccb 帐户
<b:KeyValuePairOfstringanyType>
<c:key>title</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Its a sunday web case - second</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>incident</b:LogicalName>
<b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
</entity>
</Create>