Hi
I'm new to the Dynamics environment & started to learn the development, I tried to create a save the contact by providing the required details on click on SAVE button throws ISV error . Could you please help me in resolving this issue
Exception Message: The method or operation is not implemented.
ErrorCode: -2147220956
HexErrorCode: 0x80040224
HexErrorCode: 0x80040224
HelpLink: http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80040224&client=platform
TraceText:
[TestD365: FirstPlugin.HelloWorld]
[76f8cb80-620d-ef11-9f89-0022486e22c5: FirstPlugin.HelloWorld: Create of contact]
[TestD365: FirstPlugin.HelloWorld]
[76f8cb80-620d-ef11-9f89-0022486e22c5: FirstPlugin.HelloWorld: Create of contact]
Activity Id: d8a51563-4a10-4555-9d29-28edefe85c5c
Here is the source code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;
using System.ServiceModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;
using System.ServiceModel;
namespace MyPlugins
{
public class HelloWorld : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
// Extract the tracing service for use in debugging sandboxed plug-ins.
// If you are not registering the plug-in in the sandbox, then you do
// not have to add any tracing service related code.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
{
public class HelloWorld : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
// Extract the tracing service for use in debugging sandboxed plug-ins.
// If you are not registering the plug-in in the sandbox, then you do
// not have to add any tracing service related code.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
// Obtain the organization service reference which you will need for
// web service calls.
IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
// web service calls.
IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
// The InputParameters collection contains all the data passed in the message request.
if (context.InputParameters.Contains(/Target/) &&
context.InputParameters[/Target/] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters[/Target/];
if (context.InputParameters.Contains(/Target/) &&
context.InputParameters[/Target/] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters[/Target/];
try
{
// TODO Plug-in business logic goes here. You can access data in the context,
// and make calls to the Organization web service using the Dataverse SDK.
{
// TODO Plug-in business logic goes here. You can access data in the context,
// and make calls to the Organization web service using the Dataverse SDK.
string firstName = string.Empty;
if(entity.Attributes.Contains(/firstname/))
{
firstName = entity.Attributes[/firstname/].ToString();
if(entity.Attributes.Contains(/firstname/))
{
firstName = entity.Attributes[/firstname/].ToString();
}
string lastName = entity.Attributes[/lastname/].ToString();
entity.Attributes.Add(/description/, /Hello world / + firstName + / / + lastName);
}
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException(/An error occurred in MyPlug-in./, ex);
}
{
throw new InvalidPluginExecutionException(/An error occurred in MyPlug-in./, ex);
}
catch (Exception ex)
{
tracingService.Trace(/MyPlugin: {0}/, ex.ToString());
throw;
}
}
}
}
}
{
tracingService.Trace(/MyPlugin: {0}/, ex.ToString());
throw;
}
}
}
}
}
Thanks
Categories:
