Skip to main content

Notifications

Dynamics 365 Community / Forums / Field Service forum / Plugin Failing on D365...
Field Service forum

Plugin Failing on D365 v9 Online when I just have tracers to test execution

Posted on by 261

I did a build for a custom wf assembly in VS 2017.

The following is my code. There is no red squigglies and registered without error:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk.Query;

namespace CustomerAsset
{
    public partial class CustomerAsset : CodeActivity
    {

        //public InArgument<EntityReference> CustomerAsset { get; set; }
        protected override void Execute(CodeActivityContext executionContext)
        {

            //Create the tracing service
            ITracingService tracer= executionContext.GetExtension<ITracingService>();
            tracer.Trace("Begin Plugin Execution");
            //Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                //DO WORK HERE
                Entity entity = (Entity)context.InputParameters["Target"];

                var targetCustAssOpHrsId = entity.Id;
                tracer.Trace(entity.LogicalName);
                tracer.Trace(targetCustAssOpHrsId.ToString());

                QueryExpression qe = new QueryExpression();
            }
            catch(Exception ex)
            {
                throw new InvalidPluginExecutionException("error in CustomerAsset custom workflow assembly");
                //throw new InvalidPluginExecutionException(ex);
            }
        }
    }
}

The following is what I already attempted:

  • Recompiled to .NET 8.5.2
  • Ensured targeting core assemblies to correct version of d365 v9 online

Is there any other gotchas? Im using dev guide rather than previous SDK so this is a bit new to me.

As you can see from code. I am just tracing. I threw a trace write after instanciating tracer and doesn't even get to that.

Also note, Im running this on-demand to test execution.

Categories:
  • Verified answer
    J. O. Profile Picture
    J. O. 261 on at
    RE: Plugin Failing on D365 v9 Online when I just have tracers to test execution

    Sorry for the typo of 8.5.2.  I meant 4.5.2 as I'm not living in the future lol.  This was answered in Stack Overflow.  I didn't have plugin trace log turned on in System Settings.

  • a33ik Profile Picture
    a33ik 84,321 Most Valuable Professional on at
    RE: Plugin Failing on D365 v9 Online when I just have tracers to test execution

    Hello,

    1. Based on the code it's not a plugin. It's custom workflow assembly.

    2. Compile your code using Framework 4.5.2.

    3. Check following post - develop1.net/.../Method-not-found-!!0-SystemArrayEmpty()

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

News and Announcements

Give Back to the Community this Month

Quick Links

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,807 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans