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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

plugin error finding in ErrorDetails file

(0) ShareShare
ReportReport
Posted on by 76

at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.CreateInternal(Entity entity, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, Dictionary`2 optionalParameters)
at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.CreateOrganizationResponse(Entity entity)
at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.CreateEdmEntity(CrmODataExecutionContext context, String edmEntityName, EdmEntityObject entityObject, Boolean isUpsert)
at Microsoft.Crm.Extensibility.OData.EntityController.PostEntitySetImplementation(String& entitySetName, EdmEntityObject entityObject)
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
Activity Id: d1a0f62f-1283-487e-a20e-3060de8537b9

The Above one is ERRORDETAILS.txt file can any onne help me where can i see the issue in the above message

*This post is locked for comments

I have the same question (0)
  • Hemanth Reddy.B Profile Picture
    76 on at

               if (context.InputParameters.Contains("Target") &&

                   context.InputParameters["Target"] is Entity)

               {

                       Entity account = (Entity)context.InputParameters["Target"];

                   try

                   {

                       string accid = account.Attributes["accountid"].ToString();

                       string fax = account.Attributes["fax"].ToString();

                       account.Attributes.Add("description", "Helloworld " + accid + fax);

                   }

    these the plugin i am using on preoperation getting above issue when i create account, can any one help me please. where did i go wrong

  • T.I.A Profile Picture
    1,760 on at

    try account.Attributes["description"] = $"Helloworld {accid } {fax}";

    or account.Attributes["description"] = String.Format("Helloworld {0} {1}", accid, fax);

  • Hemanth Reddy.B Profile Picture
    76 on at

    same issue T.I.A

  • Hemanth Reddy.B Profile Picture
    76 on at

    namespace donno

    {

       public class Contactcreation : IPlugin

       {

           public void Execute(IServiceProvider serviceProvider)

           {

               ITracingService tracingService =

                   (ITracingService)serviceProvider.GetService(typeof(ITracingService));

               IPluginExecutionContext context = (IPluginExecutionContext)

                   serviceProvider.GetService(typeof(IPluginExecutionContext));

               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"];

                   try

                   {

                       string accid = account.Attributes["accountid"].ToString();

                       string fax = account.Attributes["fax"].ToString();

                       account.Attributes["description"] = $"Helloworld {accid } {fax}";

                   }

                   catch (FaultException<OrganizationServiceFault> ex)

                   {

                       throw new InvalidPluginExecutionException("An error occurred in MyPlug-in.", ex);

                   }

                   catch (Exception ex)

                   {

                       tracingService.Trace("MyPlugin: {0}", ex.ToString());

                       throw;

                   }

    Any mistake in the code i did please let me know

  • T.I.A Profile Picture
    1,760 on at

    Entity account = new Entity("account");

    account.["description"] = $"Helloworld {accid } {fax}";

    account.["description"] = String.Format("Helloworld {0} {1}", accid, fax);

    service.Create(account);

    if you want to create an account do it like this

  • T.I.A Profile Picture
    1,760 on at

    you may want to use a pre image to bring back the values you want

  • Hemanth Reddy.B Profile Picture
    76 on at

    i just want to add account name and fax to descripption field i dont want to create account VIA plugiin i am doing it mannually

  • Suggested answer
    T.I.A Profile Picture
    1,760 on at

    Ok. so you need to get the description field in order to do this.  

    Entity account = service.Retrieve("account", account.id, new ColumnSet("description","fax"));

    if this retrieves successfully then you should be able to do what you need to 

    string accid = account.id;

    string fax = account.Attributes.Contains("fax") ? (string)account.Attributes["fax"] : null;

    if(fax  != null) {

     account.Attributes["description"] = $"Helloworld {accid } {fax}";

    }

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans