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 :
Microsoft Dynamics CRM (Archived)

Unable to call Custom workflow from D365 Action

(0) ShareShare
ReportReport
Posted on by 100

Hi All,

I was suppose to call a custom workflow from a action. My action executed successfully and when it is trying to trigger custom workflow step it is showing below error.

Sync workflow failed with error message - Unhandled Exception: Microsoft.Crm.Workflow.Services.InvalidCustomActivityExecutionException: Unexpected exception from plug-in (Execute): Method: System.NullReferenceException: Object reference not set to an instance of an object.
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)
, error code - -2147220891

Some how I understodd that my System.Activities.dll is causing the issue.

My .NET framework 4.6.1 

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi,

    I think error is occurring in your custom workflow somewhere. Check your code for that.

    Thanks:)

  • Suggested answer
    Michel Gueli Profile Picture
    982 on at

    Do you have a custom workflow assembly in your custom workflow? Try to add some null checks.

  • Sri Kanth Profile Picture
    100 on at

    HI Michel,

    The Execute Method contains no code, I was just throwing an exception to check whether the workflow is triggering or not

  • Sri Kanth Profile Picture
    100 on at

    Hi Preeti,

    The Execute Method contains no code, I was just throwing an exception to check whether the workflow is triggering or not.

  • Peter Bohn Profile Picture
    on at

    Do you found a solution for this?

    I have a similar problem.

    In wf-excecution i checked all used attributes if they are null, but even if this is not the case, the error comes sometimes.

    We use a selfmade custom workflow too.

    thx

    Greets PeB

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Sri,

    The error is due to a null reference coming through: Method: System.NullReferenceException: Object reference not set to an instance of an object.

    A good way of finding out what values are returning is to use the "Throw New Exception" method. For example: throw new Exception(quoteRef.LogicalName);

    That way you will be able to find out if there is a null reference and set a default value for if there is one.

    If you are retrieving field values, use the following syntax to set default values for entity references:

                   EntityReference AccountEntity = this.Account.Get(executionContext);

                   Entity AccountRef = service.Retrieve(AccountEntity.LogicalName, AccountEntity.Id, new ColumnSet("parentaccountid"));

                   EntityReference ParentAccountRef = AccountRef.Attributes.Contains("parentaccountid") ? (EntityReference)AccountRef["parentaccountid"] : null;

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans