D365 Commerce Receipt Extension - Multiple IRequestHandlerAsync for GetSalesTransactionCustomReceiptFieldServiceRequest

Commerce extension has been supporting multiple extensions for some time now. Recently I encountered an issue where one of the request handler for GetSalesTransactionCustomReceiptFieldServiceRequest(We have multiple extensions, each extension has its own GetSalesTransactionCustomReceiptFieldServiceRequest handler) was not handling the custom fields in dev machine. On debugging I was able to identify that this particular request handler was not executed. But the same set of extensions installed in UAT(self-hosted) is working as expected.

Eg: We have extension AExtension and BExtension installed - Both has Handler for GetSalesTransactionCustomReceiptFieldServiceRequest In Dev (Onebox)- AExtension is not getting executed and BExtension is getting executed In UAT (CSU Self hosted)- AExtension is getting executed. BExtension not verified

On further testing i was able to identify that the order of installation in UAT and the order of extensions configured in Dev is different. In Dev BExtension was higher in the config file. But in UAT since its sealed installer the AExtension is on the top. So basically Retailserver was executing only the first handler which it finds.

Now on how to execute all the handler in the chain, by default Retailserver will load all Handlers and if in any handler if the required field is not found then we can execute GetNextAsyncRequestHandler which will execute the next handler in the chain. Once the required code is added both Handlers are being executed regradless of the order they are in which they are configured/installed

Author

Suhail Ismail

Someone who is in love with Microsoft technologies and working as D365 Commerce developer

comments powered by Disqus