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

plugin error Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'SmsPlugins.ActivityParty'.

$
0
0

Hi,

I am trying in plugin to read "To" field value , but get exception:

"plugin error Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'SmsPlugins.ActivityParty'."

My code:

Guid contactId = GetContactId(target.To);

private Guid GetContactId(IEnumerable<ActivityParty> to)
{
foreach (var contact in to) //An error is thrown at this line
{
if (contact.PartyId.Id != null)
{
return contact.PartyId.Id; 
}
}

People suggest to add:

_serviceProxy.EnableProxyTypes();

but I in plugin so I am not creating serviceProxy because I have IServiceProvider.

Any idea what can I do?

Thanks!


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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