Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering a plugin on RetrieveMultiple message in pipeline simulation only works without EntityLogicalName #124

Open
CrookedGrandma opened this issue Jan 24, 2024 · 3 comments
Labels
bug Something isn't working scope-pipeline-simulation

Comments

@CrookedGrandma
Copy link

Hi guys, let me know if this is an error on my part or this is indeed a bug.

Expected behaviour
I use FakeXrmEasy in pipeline simulation mode. I want to trigger a plugin when multiple accounts are retrieved, so I register my plugin step on the RetrieveMultiple message on the account entity:

Context.RegisterPluginStep<TestPlugin>(new PluginStepDefinition
{
    MessageName = "RetrieveMultiple",
    EntityLogicalName = "account",
    Stage = ProcessingStepStage.Prevalidation,
});

Then, after I initialize my environment with one or more account records, I execute a RetrieveMultipleRequest:

Context.GetOrganizationService().RetrieveMultiple(new QueryExpression("account"));

My TestPlugin triggers and starts running its Execute method.

Actual behaviour
My TestPlugin does not trigger. I debugged using the JetBrains decompiler and it does not retrieve any registered plugin steps for that request.

Current workaround
I found that it does work when I register the plugin step without the EntityLogicalName, so:

Context.RegisterPluginStep<TestPlugin>(new PluginStepDefinition
{
    MessageName = "RetrieveMultiple",
    Stage = ProcessingStepStage.Prevalidation,
});

But I can't imagine this is intended behaviour. When registering a plugin step on the RetrieveMultiple message with the Plugin Registration Tool, I do set a target entity. Not being able to set one also implies that the plugin is triggered for any RetrieveMultiple request, which is perhaps a bit excessive.

@jordimontana82
Copy link
Contributor

Nice GitHub username :)

I can reproduce the same behavior, so will add it as a bug.

Not sure if you're using it as part of a commercial license, if so, please let me know so we can prioritise it.

image

@jordimontana82 jordimontana82 added bug Something isn't working and removed needs-investigation labels Feb 4, 2024
@CrookedGrandma
Copy link
Author

Thanks for investigating! I am using a non-commercial license and I have a workaround for now since my UTs are seperate for each entity. So by all means, fix this when you have the time. :)

@jordimontana82
Copy link
Contributor

Grand!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scope-pipeline-simulation
Projects
None yet
Development

No branches or pull requests

2 participants