web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / Saving of the Contact ...
Sales forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Saving of the Contact form throws ISV error

Posted on by
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
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]
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;
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));
            // Obtain the execution context from the service provider.  
            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);
 
            // 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/];
                 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.
                    string firstName = string.Empty;
                   
                    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);
                }
                catch (Exception ex)
                {
                    tracingService.Trace(/MyPlugin: {0}/, ex.ToString());
                    throw;
                }
            }
        }
    }
}
 
 
 
 
 
 
 
 
 
 
Thanks
 
 
 
Categories:

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Sales

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans