Я пытаюсь синхронизировать данные с сервера CRM обратно в отдельный сервис, и я собираюсь сделать это с помощью плагина CRM.Это работает в большинстве случаев, но в случае события обновления для объекта «Контакт», с которым у меня возникают проблемы.
Для внешней службы требуется одновременная синхронизация всех полей, но событие обновления предоставляет только измененные поля.поэтому я добавляю PreImage для события Contact., как подробно описано здесь
Это предоставляет некоторые поля для Контактного лица, но некоторые все еще отсутствуют.Поля адреса удаляются со ссылкой на AddressID, но в Contact Entity все еще есть поля, которые, похоже, не добавляются в плагин.
Поля приветствия, email1, phone1, по-видимому, отсутствуют.Поля перечислены в пользовательском интерфейсе preImage инструмента регистрации плагинов, но они не отображаются в том, что входит в код.
Как мне получить к ним доступ?
<PreEntityImages xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringEntitygUGIFE1S>
<b:key>UpdateContactPreImage</b:key>
<b:value>
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>customertypecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>mobilephone</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">mobile</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>merged</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>territorycode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>haschildrencode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>exchangerate</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:decimal">1.0000000000</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>preferredappointmenttimecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address2_addresstypecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>isbackofficecustomer</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>owningbusinessunit</b:key>
<b:value i:type="a:EntityReference">
<a:Id>250293c1-99fe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>businessunit</a:LogicalName>
<a:Name i:nil="true"/>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>owninguser</b:key>
<b:value i:type="a:EntityReference">
<a:Id>081693c1-99fe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>systemuser</a:LogicalName>
<a:Name i:nil="true"/>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>lastname</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">[test] Last Name</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotpostalmail</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotphone</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>preferredcontactmethodcode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>educationcode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>ownerid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>081693c1-99fe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>systemuser</a:LogicalName>
<a:Name>System Administrator</a:Name>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>customersizecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>firstname</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">[test] First Name 14/03/2012 9:56:54 AM</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>yomifullname</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">
[test] First Name 14/03/2012 9:56:54 AM [test] Last Name
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address2_shippingmethodcode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotemail</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>fullname</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">
[test] First Name 14/03/2012 9:56:54 AM [test] Last Name
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address1_addressid</b:key>
<b:value xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/" i:type="c:guid">f1091577-68ca-4e47-8af0-062433964799</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address2_freighttermscode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>statuscode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>createdon</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2012-02-20T05:02:03Z</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotsendmm</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotfax</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>leadsourcecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address1_country</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">0</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>creditonhold</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>telephone2</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">homephone</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>shippingmethodcode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>1</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>telephone1</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">businessphone</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>transactioncurrencyid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>c5d4dc22-9afe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>transactioncurrency</a:LogicalName>
<a:Name>Australian Dollar</a:Name>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotbulkemail</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>modifiedby</b:key>
<b:value i:type="a:EntityReference">
<a:Id>081693c1-99fe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>systemuser</a:LogicalName>
<a:Name>System Administrator</a:Name>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>createdby</b:key>
<b:value i:type="a:EntityReference">
<a:Id>081693c1-99fe-e011-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>systemuser</a:LogicalName>
<a:Name>System Administrator</a:Name>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>contactid</b:key>
<b:value xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/" i:type="c:guid">e5f28440-7f5b-e111-b93d-0019b9f1ed44</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>modifiedon</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2012-03-13T23:56:55Z</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>participatesinworkflow</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>statecode</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>0</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>address2_addressid</b:key>
<b:value xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/" i:type="c:guid">6c3024e7-5eba-4394-9192-e7106db17c0e</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>donotbulkpostalmail</b:key>
<b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:boolean">false</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true"/>
<a:FormattedValues>
<a:KeyValuePairOfstringstring>
<b:key>customertypecode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>merged</b:key>
<b:value>No</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>territorycode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>haschildrencode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>exchangerate</b:key>
<b:value>1.0000000000</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>preferredappointmenttimecode</b:key>
<b:value>Morning</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>address2_addresstypecode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>isbackofficecustomer</b:key>
<b:value>No</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotpostalmail</b:key>
<b:value>Allow</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotphone</b:key>
<b:value>Allow</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>preferredcontactmethodcode</b:key>
<b:value>Any</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>educationcode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>customersizecode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>address2_shippingmethodcode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotemail</b:key>
<b:value>Allow</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>address2_freighttermscode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>statuscode</b:key>
<b:value>Active</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>createdon</b:key>
<b:value>2012-02-20T15:02:03+10:00</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotsendmm</b:key>
<b:value>Send</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotfax</b:key>
<b:value>Allow</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>leadsourcecode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>creditonhold</b:key>
<b:value>No</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>shippingmethodcode</b:key>
<b:value>Default Value</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotbulkemail</b:key>
<b:value>Allow</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>modifiedon</b:key>
<b:value>2012-03-14T09:56:55+10:00</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>participatesinworkflow</b:key>
<b:value>No</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>statecode</b:key>
<b:value>Active</b:value>
</a:KeyValuePairOfstringstring>
<a:KeyValuePairOfstringstring>
<b:key>donotbulkpostalmail</b:key>
<b:value>No</b:value>
</a:KeyValuePairOfstringstring>
</a:FormattedValues>
<a:Id>e5f28440-7f5b-e111-b93d-0019b9f1ed44</a:Id>
<a:LogicalName>contact</a:LogicalName>
<a:RelatedEntities/>
</b:value>
</a:KeyValuePairOfstringEntitygUGIFE1S>
</PreEntityImages>