Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

CRM 4: Pre-Create Plugin with Advanced Developer Extensions

$
0
0

I've previously used dynamic entities in pre-create plugins to amend data before it gets passed to the platform. In this scenario, there is no need to make any update requests etc as I was just manipulating the target entity from the plugin execution context: any changes made to the target entity are persisted when the core platform create event takes place.

I've recently started a new project for which I'm using the Advanced Developer Extensions allowing me to work with LINQ and strong types generated by CrmSvcUtil. I'm looking to utilize the same functionality without having to resort to dynamic entities (the old fashioned way) but I cannot work out how to make changes to a strongly typed object representing the target entity and have them included in the create event.

The code I'm using to obtain a strongly typed version of the target entity is:

DynamicEntity target = (DynamicEntity)_context.InputParameters[ParameterName.Target];      
new_myentity myTarget = target.ToCrmEntity(xrmDataContext).ToCrmEntity<new_myentity>();

It seems that myTarget is an instance of the new_myentity type with copies of the properties fromtarget but any changes I make to myTarget do not get reflected in the properties oftarget. I'm not seeing the changes I made when data gets written back to CRM.

Is it possible to achieve this using strong types or will I have to go back to manipulating the properties of the target dynamic entity as normal?


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>