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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

i am getting error when I create a contact based on account.

(0) ShareShare
ReportReport
Posted on by 20

dear sir,please error log.

Unhandled exception: 
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute):  WordCountWorkflow.WordCount: System.NullReferenceException: Object reference not set to an instance of an object.Detail: 

  6dff47fa-52ef-4fd3-93c0-47cc509ec6de
  -2147220891
  
    
      ApiExceptionSourceKey
      Plugin/$Microsoft.Crm.Workflow.Services.ProxyCustomActivity
    
    
      ApiOriginalExceptionKey
      Microsoft.Crm.CrmException: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute):  WordCountWorkflow.WordCount: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Crm.Sandbox.SandboxCodeUnit.ProcessException(Exception originalException, IExecutionContext context, SandboxClient client, SandboxCallTracker callTracker, Boolean isSafeToRetry, DateTime performanceExecutionStartTime, SandboxTracker tracker, Guid parentExecutionId, CrmException& crmException, String& assemblyContents)
   at Microsoft.Crm.Sandbox.SandboxCodeUnit.<>c__DisplayClass24_0.b__0()
   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
   at Microsoft.Xrm.RemotePlugin.CrmProvider.RemotePlugin.CDSExecute(IServiceProvider serviceProvider)
   at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
    
    
      ApiStepKey
      3be440b7-c633-ea11-a813-000d3af270de
    
    
      ApiDepthKey
      2
    
    
      ApiActivityIdKey
      4e2da93c-def1-4ec7-bfad-dae5903b1fb6
    
    
      ApiPluginSolutionNameKey
      System
    
    
      ApiStepSolutionNameKey
      System
    
    
      ApiExceptionCategory
      ClientError
    
    
      ApiExceptionMesageName
      IsvUnExpected
    
    
      ApiExceptionHttpStatusCode
      400
    
    
      OperationStatus
      0
    
    
      SubErrorCode
      -2146233088
    
  
  http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException:80040265&client=platform
  An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute):  WordCountWorkflow.WordCount: System.NullReferenceException: Object reference not set to an instance of an object.
  2020-01-16T14:26:34.201675Z
  false
  
  
  
  

[ClassLibrary2: ClassLibrary2.Class1]
[7012e08a-c137-ea11-a813-000d3af270de: ClassLibrary2.Class1: Create of account]

	
	[Microsoft.Crm.ObjectModel: Microsoft.Crm.ObjectModel.SyncWorkflowExecutionPlugin]
	[3be440b7-c633-ea11-a813-000d3af270de: ]
	Starting sync workflow 'shan', Id: 34e440b7-c633-ea11-a813-000d3af270de
	Entering CustomActivityStep1_step: 
	Sync workflow 'shan' terminated with error 'An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute):  WordCountWorkflow.WordCount: System.NullReferenceException: Object reference not set to an instance of an object.'
	


ing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;



namespace ClassLibrary2
{
    public class Class1 : IPlugin
    {
        public object Account { get; private set; }

        public void Execute(IServiceProvider serviceProvider)
        {

            //Extract the tracing service for use in debugging sandboxed plug-ins.
            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.
            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

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

            {
                Entity account = (Entity)context.InputParameters["Target"];
                Entity contact = new Entity("contact");
                contact.Attributes["firstname"] = account.Attributes["name"];
                Guid contactid = service.Create(contact);
                account.Attributes["primarycontactid"] = new EntityReference("contact", contactid);

            }
        }
    }
}
WhatsApp-Image-2020_2D00_01_2D00_16-at-9.49.25-AM.jpeg

please help me to resolve the error 

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Based on your screenshot it's not a problem of plugin you work on - it's an issue that comes from other plugin or real-time workflow. To get more info can you please click "Download Log File" copy the text and paste it here?

  • David Jennaway Profile Picture
    14,065 on at

    The error is being thrown by a different custom plugin (WordCountWorkflow). Based on the (not very helpful) error, it looks like the plugin expects a value in a field on the contact that you've not populated

  • tctsl1013 Profile Picture
    20 on at

    yes sir.....but i have De-activate the workflow but still i am getting this error.

    actually i am new to MS DYNAMICS 365 .

  • tctsl1013 Profile Picture
    20 on at

    thanks for reply sir....can i send my instance ..?

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    What workflow did you deactivate? Is it the one called "shan"?

  • tctsl1013 Profile Picture
    20 on at

    URL:tctsl1013.crm8.dynamics.com/main.aspx

    user name:muralikrishna@TCTSL1013.onmicrosoft.com

    password:Dynamics365

  • tctsl1013 Profile Picture
    20 on at

    no sir "muralikrishna"

  • tctsl1013 Profile Picture
    20 on at

    deactivated the word count workflows same as try to unregistered the same word count workflow

    plugin in plugin registration tool but i was not unregistered.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Don't get me wrong - I will not touch your instance and it's safer for you to delete credentials.

    The workflow that causes error is called "shan" according to your log. Deactivate or fix it.

  • tctsl1013 Profile Picture
    20 on at

    sir.....superb awesome, no words to your analysis.  my plugin  is executed i have get output .

    how to analyse the error log code ..?

Under review

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

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans