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
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}";
}
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
you may want to use a pre image to bring back the values you want
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
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
same issue T.I.A
try account.Attributes["description"] = $"Helloworld {accid } {fax}";
or account.Attributes["description"] = String.Format("Helloworld {0} {1}", accid, fax);
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
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6