Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Suggested answer

Extension not showing in Commerce Scale Unit metadata

Posted on by 1,433

I have created a new retail server extension.  

/* ****

[Export(typeof(IEdmModelExtender))]
    [ComVisible(false)]
    public class EdmModelExtender : IEdmModelExtender
    {
        
        public void ExtendModel(CommerceModelBuilder builder)
        {
            ThrowIf.Null(builder, "builder");
            var action = builder.BindAction("TMCGetReservedOrdersAction");
            action.Parameter<string>("ItemId");
            action.Parameter<string>("WhseId");
            action.ReturnsCollection<FulfillmentReservedOrders>();
        }
    }

******/

The controller is a NonBindableOperationController and has the following method:

/* ****

 [HttpPost]
        [CommerceAuthorization(CommerceRoles.Anonymous, CommerceRoles.Customer, CommerceRoles.Device, CommerceRoles.Employee)]
        public Microsoft.Dynamics.Commerce.Runtime.PagedResult<FulfillmentReservedOrders> TMCGetReservedOrdersAction(ODataActionParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }
            string itemId = (string)parameters["ItemId"];
            string whseId = (string)parameters["WhseId"];
            QueryResultSettings queryResultSettings = QueryResultSettings.AllRecords;
            queryResultSettings.Paging = new PagingInfo(10);
            GetReservedOrdersRequest request = new GetReservedOrdersRequest(itemId, whseId) { QueryResultSettings = queryResultSettings };
            GetReservedOrdersResponse response = this.CommerceRuntime.Execute<GetReservedOrdersResponse>(request, request.RequestContext);
            return response.FulfillmentLines;
        }

**** */

The DLL generates without errors.

The CRT code has a commerceEntitiy class called FulfillmentReservedOrders, and a service class that extends IRequestHandler as wella s th erequest and response classes.

This DLL also generates correctly.

I was also able to generate the TypeScript proxy without errors and it created the DataServiceRequests.g and DataServiceentites.g which I imported in POS.

I copied the DLLs to Retailserver\Webroot\bin\Ext and also updated the CommerceRuntime.Ext in this folder with the CRT code DLL.

I also updated the RetailServer\Webroot\Web.config to have the retailServer DLL included.

I then ran in the commandPrompt IISReset to restart the IIS. I also in the IIS Services Manager stopped and started the RetialServer site.

When I open now https://Your Commerce Scale Unit URL/Commerce/$metadata, it doesn't show my method or entity. 

Any idea why not?

Any help is much appreciated

  • Retha Profile Picture
    Retha 1,433 on at
    RE: Extension not showing in Commerce Scale Unit metadata

    Hi Ram,

    For the extensions not showing up in the scale unit Microsoft didn't do anything after hearing that we will upgrade to V10.0.12. Just that I should let them know if it fixes the issue. However they did confirm that the document misspelled the hostings.contracts package and they have fixed the document in the meantime. It shows now the correct package.

    Upgrade to v10.0.12 and switch to the hostings.contracts nuget package and applied the changes in the link to use IController fixed the issue in my case

  • Suggested answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: Extension not showing in Commerce Scale Unit metadata

    I believe you have logged case with Microsoft support. Please update your findings here so it will be useful for others. Thanks!

  • Retha Profile Picture
    Retha 1,433 on at
    RE: Extension not showing in Commerce Scale Unit metadata

    I upgraded to v10.0.12 and my retail server extensions are now loaded into the scale unit's metadata.

    I had to change to the new IController. The "missing" DLL to be used was there in the end, it was just misspelled in the documentation. It was supposed to read:  Microsoft.Dynamics.Commerce.Runtime.Hosting.Contracts. Microsoft has fixed it.

    Now I'm trying to understand their new way of generating the TypeScript proxy which is supposed to be easier but isn't.

    I get the NU115 error even on the StoreHoursSample type script proxy example

  • Suggested answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: Extension not showing in Commerce Scale Unit metadata

    The section was always comes with note that "Is is for development purpose only". Purpose of those tags are to copy the binaries at the respective locations.  But those binaries (Retail Server, hardware station and CRT) we can be manually copy to test customizations.  

    pastedimage1597812269785v1.png

    The steps for any customizations are as below - 

    - Build your customizations with respective Retail SDK

    - Drop your binaries at appropriate locations 

    - Configure extension in web.config and commerceruntime.exe.config and and test your customizations. 

    I believed you have performed all above steps so I will recommend you to raise a support case with Microsoft to help on this issue. 

  • Retha Profile Picture
    Retha 1,433 on at
    RE: Extension not showing in Commerce Scale Unit metadata

    My first retail server extension was done on v10.0.8 and it showed in the commerce scale unit metadata.

    Back then the Customizations.Settings file still had the following entry:

    ***

    <ItemGroup Condition="'@(RetailServerLibraryPathForProxyGeneration)' == ''">

       <!--

         Use this variable to specify the paths of assemblies that are used to generate the proxy code. The first one must be the RetailServerLibrary.dll.

         Put the assemblies that implement IEdmModelExtender after the RetailServerLibarary.dll.

       -->

       <RetailServerLibraryPathForProxyGeneration Include="$(PkgMicrosoft_Dynamics_Retail_RetailServerLibrary)\lib\net461\Microsoft.Dynamics.Retail.RetailServerLibrary.dll"/>

       <!--

         Examples of extended metadata assemblies paths:

         <RetailServerLibraryPathForProxyGeneration Include="$(SdkReferencesPath)\Microsoft.Dynamics.RetailServer.CrossLoyaltySample.dll"/>

         <RetailServerLibraryPathForProxyGeneration Include="$(SdkReferencesPath)\Microsoft.Dynamics.RetailServer.StoreHoursSample.dll"/>

       -->

     </ItemGroup>

    ***

    This entry was removed from the customizations,Settings file starting v10.0.10 I assume. We went from v10.0.8 to v10.0.10.

    Now not even my first retail server extension is showing in the metadata.

    Nothing changed except for the above entry that isn't there anymore.

    So with us now on v10.0.11 and the DLL I'm supposed to use not in this versions RetailSDK and the above entry missing from the customizations.Settings file, what do I need to do to get my retail server extension showing up in the metadata?

  • Suggested answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: Extension not showing in Commerce Scale Unit metadata

    It is not required to update your code as of now to new model of retail server extension. Old model still supported but if someone wants to use new way they can.

    Sample extensions are updated in version 10.0.13 and onwards. You can take reference from those to implement in 10.0.11.

  • Retha Profile Picture
    Retha 1,433 on at
    RE: Extension not showing in Commerce Scale Unit metadata

    We are on v10.0.11 (10.0.464.30003) and the RetailSdk that comes with this version doesn't have the NuGet package Microsoft.Dynamics.Commerce.Hosting.Contracts that is supposed to be in folder RetailSDK\pkgs.

  • Retha Profile Picture
    Retha 1,433 on at
    RE: Extension not showing in Commerce Scale Unit metadata

    I just came across this: docs.microsoft.com/.../retail-server-icontroller-extension

    I will change my code accordingly and see if it then works. Mine still use the v10.0.10 and prior logic. But for v10.0.11 which is the version we are on now, I need to use a different approach to get it generated. It's unfortunate that none of the end-to-end examples that MSFT is talking about in the link uses this approach even though the examples comes with the v10.0.11 retailSDK but they still uses the previous v10.0.10 logic.

  • Suggested answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: Extension not showing in Commerce Scale Unit metadata

    Hi Retha, 

    I do not see type 'FulfillmentReservedOrders' in existing metadata. Is it your custom type or part of standard CRT types.

    Anyway if it's not exposed in metadata you should complex type in 'CommerceModelFactory' extension.

    In case FulfillmentReservedOrders is entity, we should prefer to create commerce controller instead of NonBindableOperationController . 

    Regards, 

    Ram

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans