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

Importing and the Plugin Target Entity

$
0
0

Consider a plugin (code shown below) that fires only on Create of an Account.  All I want it to do right now is give me a list of all the attributes in the target entity so that I can prove a point.

On the Account form in CRM, 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.

I have confirmed that the import record is fine.  If I import it, I see it under the accounts and if I open it, I see the primary contact.  What is really weird is that every other attribute (that changed) is present in the target entity as expected.  The only one missing which is the only one I care about is the primary contact.  If I create the account record manually (not via import) the primary contact is included in the target entity attributes collection.

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 8223

Trending Articles



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