| Daren 的个人资料Daren Turner日志列表 | 帮助 |
|
|
3月28日 Replicating CRM Records to another CRM SystemA friend of mine called me up and asked if it was possible to create records in one CRM system when they are created in another one. Well here is a quick example of how to do it. Assumptions
If there are discrepencies with the guids in each system, there will be issues with this example. When the postImageEntityXml is Deserialized into a DynamicEntity, it has the guid of the source system. When it's created in the target system, it's created with the same guid. For this example I will show you a simple Post Callout to replicate a Create action, but I recommend sending these transactions to a Message Queue and then processing them from there. It's also not only limited to Create, the same thing can be done for other actions. Code public override void PostCreate(CalloutUserContext userContext, CalloutEntityContext entityContext, string postImageEntityXml) //build the credentials for access if the current user doesn't have access. DynamicEntity entity = (DynamicEntity)Serialization.DeserializeBusinessEntity(postImageEntityXml); TargetCreateDynamic targetCreate = new TargetCreateDynamic(); CreateRequest request = new CreateRequest(); request.Target = targetCreate; CRMSDK.CreateResponse response = (CRMSDK.CreateResponse) service.Execute(request); return entity; This code isn't entity specific so it will work for most of the entities in CRM. All the entity information is in the postImageEntityXml and is Deserialized into the DynamicEntity. Callout Registration <callout entity="account" event="PostCreate"> <callout entity="contact" event="PostCreate"> There are a lot more things you can do to improve this process. This is just a simple example. Some other things to consider adding into your solution is Message Queueing and Exception Handling. Hope this helps. A big shout out to Henry who is out in Ohio this week :).
This customization may not be supported by Microsoft and is provided as-is with no warranty. 引用通告此日志的引用通告 URL 是: http://dtu11.spaces.live.com/blog/cns!D01B965C27CB1CC6!136.trak 引用此项的网络日志
|
|
|