Dynamics-365-Workflow-Tools
Dynamics-365-Workflow-Tools copied to clipboard
CalculateRollup error, help please?
I'm hoping I've just done something incorrect
Expected behavior and actual behavior.
Expected: parent roll-up field, pm_answeredcount is re-calculated Actual: workflow fails with this error for the user
'pm_PreliminaryRiskAssessment' entity doesn't contain attribute with Name = 'pm_answeredcount ' and NameMapping = 'Platform'. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=2961192, MinActiveRowVersion=2961192, MetadataInstanceId=46321125, LastUpdated=2022-02-01 05:47:23.243
and this comment in the log:
Sync workflow failed with error message - Exception type: Microsoft.Crm.CrmException Message: 'pm_PreliminaryRiskAssessment' entity doesn't contain attribute with Name = 'pm_answeredcount ' and NameMapping = 'Platform'. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=2961192, MinActiveRowVersion=2961192, MetadataInstanceId=46321125, LastUpdated=2022-02-01 05:47:23.243 at Microsoft.Xrm.RemotePlugin.Client.Interceptors.SandboxFabricClientTelemetryInterceptor.<>c__DisplayClass3_0.<Intercept>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.Client.Interceptors.SandboxFabricClientTelemetryInterceptor.Intercept(IInvocation invocation, IExecutionContext context, SandboxFabricCallTracker sandboxFabricCallTracker) at Microsoft.Xrm.RemotePlugin.Client.Interceptors.SandboxFabricCodeUnitExecuteBaseInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.ISandboxFabricCodeUnitProxy.Execute(ILifetimeScope scope, IExecutionContext context, SandboxFabricCallTracker& sandboxFabricCallTracker) at Microsoft.Xrm.RemotePlugin.Client.SandboxFabricPlugin.<>c__DisplayClass5_1.<Execute>b__3() at Polly.Policy.<>c__DisplayClass150_0
1.<Execute>b__0(Context ctx, CancellationToken ct) at Polly.Policy.<>c__DisplayClass143_01.<ExecuteInternal>b__0(Context ctx, CancellationToken ct) at Polly.RetrySyntax.<>c__DisplayClass12_1.<WaitAndRetry>b__1(Context ctx, CancellationToken ct) at Polly.Retry.RetryEngine.Implementation[TResult](Func
3 action, Context context, CancellationToken cancellationToken, IEnumerable1 shouldRetryExceptionPredicates, IEnumerable
1 shouldRetryResultPredicates, Func1 policyStateFactory) at Polly.RetrySyntax.<>c__DisplayClass12_0.<WaitAndRetry>b__0(Action
2 action, Context context, CancellationToken cancellationToken) at Polly.Policy.ExecuteInternal[TResult](Func3 action, Context context, CancellationToken cancellationToken) at Polly.Policy.Execute[TResult](Func
3 action, Context context, CancellationToken cancellationToken) at Polly.Policy.Execute[TResult](Func1 action) at Microsoft.Xrm.RemotePlugin.Client.SandboxFabricPlugin.Execute(IServiceProvider serviceProvider) at Microsoft.Xrm.RemotePlugin.Client.ResilientSandboxPlugin.<>c__DisplayClass13_1.<Execute>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.Client.ResilientSandboxPlugin.Execute(IServiceProvider serviceProvider) at Microsoft.Xrm.RemotePlugin.CrmProvider.RemotePlugin.RemotePluginExecute(IServiceProvider serviceProvider, ILifetimeScope lifetimeScope, IExecutionContext executionContext, ILogger logger) at Microsoft.Xrm.RemotePlugin.CrmProvider.RemotePlugin.Execute(IServiceProvider serviceProvider) at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext) -- End stack trace --Exception type: Microsoft.Crm.Workflow.Services.InvalidCustomActivityExecutionException Message: 'pm_PreliminaryRiskAssessment' entity doesn't contain attribute with Name = 'pm_answeredcount ' and NameMapping = 'Platform'. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=2961192, MinActiveRowVersion=2961192, MetadataInstanceId=46321125, LastUpdated=2022-02-01 05:47:23.243 at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary
2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout) at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary
2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions) at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.ExecuteWorkflowUsingInvoker(Activity workflow, ICommonWorkflowContext context) at Microsoft.Crm.Workflow.SynchronousRuntime.SynchronousWorkflowActivityHost.StartWorkflow(WorkflowActivationData activationData, ICommonWorkflowContext context) -- End stack trace --, error code - -2147220891
pm_answeredcount is definitely the roll-up field name
Steps to reproduce the problem (screenshots are really usefull)
- Create custom parent entity, pm_PreliminaryRiskAssessment with rollup field pm_answeredcount = COUNT(PRAresponses with statecode = "answered")
- Create custom child entity, PRAresponse
- Add workflow to PRAresponse entity that runs when statecode field changes
- Add one step to workflow: msdyncrmWorkflowTools.CalculateRollupField, with the following properties
CRM Version - online/onpremise - WorkflowTools version
Power Apps cloud. I used this fork of your tools, but I do not think that is the issue.
Since I wasn't having any luck with the workflow, I decided to try replicating the function with javascript and a webAPI call. What I discovered is that I could generate the same error as above if I used the singular instead of plural entity name. ie: pm_preliminaryriskassessment instead of pm_preliminaryriskassessments.
When I used the workflow, the forms assistant generated the parent record URL. So I'm not sure why it generated a singular version. Any ideas?