InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'Xrm.new_salestransaction.
-
sábado, 5 de maio de 2012 01:39
Hi there,
I have the Xrm class in a class library which my plugin project reference. But getting the InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'Xrm.new_salestransaction. How do I need to do? Thanks
publicvoidExecute(IServiceProviderserviceProvider)
{
ITracingServicetracingService =
(
ITracingService)serviceProvider.GetService(typeof(ITracingService));
serviceProvider.GetService(
typeof(IPluginExecutionContext));
IPluginExecutionContextcontext = (IPluginExecutionContext)IOrganizationServiceFactoryserviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationServiceservice = serviceFactory.CreateOrganizationService(context.UserId);
varCrmContext = new Xrm.XrmServiceContext(service);
var entity = CrmContext.new_salestransaction.Where(o => o.aea_BatchId.Id == batchId).singleorDefault();
- Editado SPCRM2011 sábado, 5 de maio de 2012 01:47
Todas as Respostas
-
sábado, 5 de maio de 2012 02:14
you could change the last line to use new_salestraction x =
Sam
Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
-
sábado, 5 de maio de 2012 11:08
That did not help. Please help.
Thanks