Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Importing and the Plugin Target Entity

$
0
0

Consider a plugin (code shown below) that fires only on Create of an Account.

On the Account form, you enter the Account Name, select a Primary Contact, and hit save.  The plugin Target entity will contain the primary contact id.

Import a single Account record that has only a Name, and a Primary Contact.  The plugin Target entity will NOT contain the primary contact id.

The account will get created and if you open that account record in CRM, you can clearly see the primary contact so the import record was good.  However at the plugin level, the target entity will include all attributes except for the primary contact.  This issue is easy to replicate.

The code shown will cancel the Account create transaction but you can clearly see that the primary contact attribute is missing.  I have some other code that writes all these fields out to a new test record so that it is easier to see them all and also also the transaction to complete.  Any help with this would be greatly appreciated.

 

Entity targetEntity = (Entity)context.InputParameters["Target"];

string fields = "";

foreach (var att in targetEntity.Attributes)

{

fields += att.Key + Environment.NewLine;

}

throw new InvalidPluginExecutionException(fields);

 


Viewing all articles
Browse latest Browse all 82002

Trending Articles



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