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

Update entity on create of another entity record - Plugin CRM 2011

$
0
0

Trying to Update entity A on create of another entity B record through plugin in CRM 2011.

While debugging it throws an error " {"Could not load file or assembly 'Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}" at line UpdateTraining(service);

UpdateTraining is where the logic is written

Anyone has any references ??

namespace UpdateTraining
{
public class Class1 : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{

// Obtain the execution context from the service provider.
IPluginExecutionContext context =
(IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

// Get a reference to the Organization service.
IOrganizationServiceFactory factory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.UserId);


if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{

Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName == "new_assessment")
{
try
{

UpdateTraining(service);

}
catch(Exception e)
{
throw new InvalidPluginExecutionException("cannot set." + e);
}

}
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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