Hi all,
I written a plugin that works on a dev environnement, and does not work in Live environnement.
This plugin has been simplified now, just to change a integer value (compiled in Framework 4 in both environnements - works on Dev only).
Other plugins (e.g. creates an annotation on this specific entity) works in both environnements.
This Dev environment is a sql copy of Live environnement (CRM organization imported).
This Dev environnement is not on ADFS, Win Server 2012 R2, CRM v6.1.4.145
The Live environnementis on ADFS, Win Server 2008 R2 Std, CRM v6.1.3.119
I tried to get a clear error message, using traces.
But this is not clear, any help is appreciated
Thanks Nicolas
using System;
using System.ServiceModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;
namespace Plugin_DCS
{
public class sample_USP_OnCreate_changeName:IPlugin
{ public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName != "new_pieceutilisee")
return;
try
{
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
tracingService.Trace("rework on usp.");
New_pieceutilisee currentUsp = new New_pieceutilisee();
currentUsp.New_pieceutiliseeId = new Guid(context.OutputParameters["id"].ToString());
currentUsp.New_Quantite = 3;
tracingService.Trace("rework on usp. tididi");
service.Update(currentUsp);
tracingService.Trace("rework on usp. done");
}
//<snippetFollowupPlugin3>
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException("An error occurred in the USP_OnCreate_changeName plug-in.", ex);
}
//</snippetFollowupPlugin3>
catch (Exception ex)
{
tracingService.Trace("USP_OnCreate_changeNamePlugin: {0}", ex.ToString());
throw;
}
}
}
}
}
//</snippetFollowupPlugin>
*This post is locked for comments
I have the same question (0)