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

Error creating Mockup instance having Plugins without registered Message Processing Steps #246

Open
maerger opened this issue Jan 3, 2025 · 1 comment

Comments

@maerger
Copy link

maerger commented Jan 3, 2025

Describe the bug
I use plugin types for custom API without any registered message processing step. Unfortunately, the creation of the Xrm instance fails because the plugin type is not recognized in the metadata. If I check the assembly in the online instance the plugin type exists. Creating a step on the plugin will affect the metadata created with the creation tool... so possibly a "dummy step" could solve the issue.

To Reproduce

  • Create and register a Plugin without any step online
  • Create the metadata for this online instance
  • The creation of the instance fails with error message: "OneTimeSetUp: DG.Tools.XrmMockup.MockupException : Unknown plugin 'Plgin name', please use DAXIF registration or make sure the plugin is uploaded to CRM."

Expected behavior
The metadata tool should create the plugin metadata or plugins without message processing steps should be ignored on cretaing the instance

Environment

  • D365 online
  • Tool version: 1.13.3
@mkholt
Copy link
Member

mkholt commented Jan 7, 2025

How are you registering the Custom API's?

DAXIF has a CustomAPI base class which should be extended in CustomAPI implementations, and which XrmMockup will recognize.

Once it has been extended, you can then register the API in the constructor using the same logic as for plugins, and they will be automatically handled in the PluginSync functionality.

Example (see the CustomAPI class for supported methods, unfortunately the Wiki doesn't seem to be updated):

public class MyCustomAPI: CustomAPI
{
    private static class ResponseProperties
    {
        public const string ResponseStatusCode = nameof(ResponseStatusCode);
        public const string ResponseMsg = nameof(ResponseMsg);
    }

    public MyCustomAPI() : base(typeof(MyCustomAPI))
    {
        RegisterCustomAPI(nameof(MyCustomAPI), ExecuteAction)
            .AddResponseProperty(
                new CustomAPIConfig.CustomAPIResponseProperty(ResponseProperties.ResponseStatusCode, RequestParameterType.Integer))
            .AddResponseProperty(
                new CustomAPIConfig.CustomAPIResponseProperty(ResponseProperties.ResponseMsg, RequestParameterType.String))
            .MakePrivate();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants