magento 2 erp integration best practices: microsoft dynamics
TRANSCRIPT
![Page 1: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/1.jpg)
![Page 2: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/2.jpg)
Page | 2© 2017 Mage Titans
Magento 2 ERP Integration Best Practices: Microsoft Dynamics
![Page 3: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/3.jpg)
Page | 3© 2017 Mage Titans
Joshua WarrenCEO, Creatuity@JoshuaSWarren / #MageTitansUSA
![Page 4: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/4.jpg)
Introductions
![Page 5: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/5.jpg)
Page | 5© 2017 Mage Titans
• Family of ERP systems
• Dynamics AX• Dynamics GP• Dynamics NAV• Dynamics SL• Dynamics C5
Microsoft Dynamics
![Page 6: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/6.jpg)
Page | 6© 2017 Mage Titans
• Manages finance, manufacturing, CRM, supply chain and inventory for medium-sized enterprises
Microsoft Dynamics NAV
![Page 7: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/7.jpg)
Page | 7© 2017 Mage Titans
• Needs no introduction
Magento Commerce
![Page 8: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/8.jpg)
Page | 8© 2017 Mage Titans
• Business processes such as fulfillment and inventory management become highly automated
• Employees don’t waste time manually entering data
• Focus on delivering unique value – not just doing the things a computer could do
Magento Commerce + Dynamics NAV
![Page 9: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/9.jpg)
Page | 9© 2017 Mage Titans
• Stable, scalable integration
• Simple to maintain, low cost of ownership – no one wants to spend their budget on ERP integrations
• Easy to support – no one wants to answer tickets about an ERP integration
Project Goals
![Page 10: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/10.jpg)
Page | 10© 2017 Mage Titans
• Import basic product & inventory data from Dynamics (no PIM)
• Export customers and orders from Magento into Dynamics
• Import shipment data from Dynamics
• Don’t break the Dynamics-powered POS deployed in 30+ stores –this is a real-world deployment, not a theoretical project
Business Goals
![Page 11: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/11.jpg)
Page | 11© 2017 Mage Titans
![Page 12: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/12.jpg)
Page | 12© 2017 Mage Titans
• Eliminate dependence on third-party encrypted ERP connectors
A Corporate Mission
![Page 13: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/13.jpg)
Page | 13© 2017 Mage Titans
• Much of this integration was designed and written by an excellent long-time member of our development team, Scott
A Special Thanks
![Page 14: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/14.jpg)
Integration Architecture
![Page 15: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/15.jpg)
Page | 15© 2017 Mage Titans
• Base module for all of our integrations
• Provides a common set of logging, reporting and UI components
• Ensures all of our integrations have a merchant-friendly admin management page
Base Module
![Page 16: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/16.jpg)
Page | 16© 2017 Mage Titans
• RabbitMQ, scalable messaging queue
• Magento 2 has native support for communicating with Rabbit
• Rabbit libraries for PHP, Java, .NET, Python, Javascript, Ruby & Go so ERP developers can use the language of their choice
RabbitMQ
![Page 17: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/17.jpg)
Page | 17© 2017 Mage Titans
• Creatuity writes the module necessary to publish and consume Rabbit messages in Magento
• ERP integrator or client’s in-house ERP team writes the code to publish and consume Rabbit messages for the ERP
RabbitMQ – In General
![Page 18: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/18.jpg)
Page | 18© 2017 Mage Titans
• Creatuity also supports the client’s Microsoft Dynamics instance, so we’re writing both ends of the connection
• Continuing to develop best practices around where to host the ERP-specific code in this case – another Magentomodule or a separate script
RabbitMQ – Microsoft Dynamics
![Page 19: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/19.jpg)
Page | 19© 2017 Mage Titans
• Does the ERP have an existing PHP library?
• If not, what language is the ERP’s library written in?
RabbitMQ – Architecture Questions
![Page 20: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/20.jpg)
Page | 20© 2017 Mage Titans
• Best case – ERP’s library is written in PHP, merchant is using Magento Commerce Cloud
• Worst case – client’s ERP utilizes an antiquated language and is hosted behind a strict firewall
RabbitMQ – Architecture Questions
![Page 21: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/21.jpg)
Page | 21© 2017 Mage Titans
• Sometimes RabbitMQ is more than a smaller site needs
• “Cron mode” enables direct communication from Magento to Dynamics using Magento’s cron system for scheduled tasks
• Works well in this case as we are responsible for both the Magento code and the ERP integration code
Rabbit Alternative - Cron Mode
![Page 22: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/22.jpg)
Page | 22© 2017 Mage Titans
• Task Layer
• Service Layer
• Data Layer
• Connection Layer
Layers
![Page 23: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/23.jpg)
Page | 23© 2017 Mage Titans
• Product update, shipment update and order update are each tasks
• Easily add new tasks in the future
• Cron and RabbitMQ level tasks occur here
Task Layer
![Page 24: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/24.jpg)
Page | 24© 2017 Mage Titans
• Used to perform requests to Microsoft Dynamics
• Executes and parses requests
Service Layer
![Page 25: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/25.jpg)
Page | 25© 2017 Mage Titans
• Contains all logic related to processing both Magento and Microsoft Dynamics data
Data Layer
![Page 26: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/26.jpg)
Page | 26© 2017 Mage Titans
• Performs and manages the actual connection to Microsoft Dynamics
• Encapsulates all connection logic so remaining code doesn’t care how the connection works or if it changes
Connection Layer
![Page 27: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/27.jpg)
Integration Implementation
![Page 28: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/28.jpg)
Page | 28© 2017 Mage Titans
• Extract data from a source
• Process, map and transform that data
• Deliver it to the destination
Basic Concepts
![Page 29: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/29.jpg)
Page | 29© 2017 Mage Titans
• Designed as a single Magento module
• Module is broken down into 10 main models to implement our layers
• Some of the models then break down into smaller components
Structure
![Page 30: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/30.jpg)
Page | 30© 2017 Mage Titans
• Keeps code clean & easy to maintain
Structure
![Page 31: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/31.jpg)
Page | 31© 2017 Mage Titans
• Manager that manages the overall data transformation process
• Extractor pulls data from source, uses a Mapper to map fields to a standard format
• Transform class performs basic transformations
Data Layer
![Page 32: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/32.jpg)
Page | 32© 2017 Mage Titans
• Processor class processes changes in Magento that need to happen based on data from the ERP
• Allows us to utilize core Magento functions for making these changes
• DI & architecture of Magento 2 makes this simple
• For instance – we use the core StockRegistryInterface API
Data Layer - Processor
![Page 33: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/33.jpg)
Page | 33© 2017 Mage Titans
$stockItem = $this->stockRegistry->getStockItem($productData->getId());
$stockItem->setQty($intermediateData->getQty())->setIsInStock($intermediateData->getIsInStock());
$this->stockRegistry->updateStockItemBySku($productData->getSku(), $stockItem);
Updating Magento Stocks from ERP
![Page 34: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/34.jpg)
Page | 34© 2017 Mage Titans
• Microsoft Dynamics NAV can be customized – field names can be changed
• Don’t hard-code field names
• Separate out implementation-specific code from platform-specific code
Lessons Learned
![Page 35: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/35.jpg)
Page | 35© 2017 Mage Titans
• 150 hours of development work and QA
• 10 hours of documentation
• Deploying this integration for future Microsoft Dynamics clients could be a 5-10 hour process
Implementation Effort
![Page 36: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/36.jpg)
End User Experience
![Page 37: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/37.jpg)
Page | 37© 2017 Mage Titans
• Customers on the site aren’t aware the ERP exists – which is our goal
• Their orders are fulfilled quickly and they receive a tracking number soon after placing their order
• If the customer experience is impacted by your ERP, there’s room to improve that integration
Customer-Facing Experience
![Page 38: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/38.jpg)
Page | 38© 2017 Mage Titans
• Warehouse staff fulfill orders out of Microsoft Dynamics as they always have – no need to login to a separate system
• Customer service representatives can view up-to-date product inventory and order status information in Magento, no need to login to Dynamics
• If a sync encounters an issue, detailed information is available in the Magento admin panel for easy troubleshooting and resolution
Admin User Experience
![Page 39: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/39.jpg)
Page | 39© 2017 Mage Titans
• Previous off-the-shelf connector required a developer to SSH to the server any time the sync failed.
• Encrypted code made debugging impossible
• No stable base for feature enhancements
Developer Experience
![Page 40: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/40.jpg)
Future Improvements
![Page 41: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/41.jpg)
Page | 41© 2017 Mage Titans
• Refactoring code to allow other members of the Microsoft Dynamics family to easily integrate with Magento
• Developing new adapters based on other integration methods (i.e., CSV files)
• Expanding to connect with other ERPs as well
Adapters
![Page 42: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/42.jpg)
Page | 42© 2017 Mage Titans
• One consistent system for all integrations, lowering maintenance costs and time to implement
• Open source? Collaboration?
Vision
![Page 43: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/43.jpg)
Results
![Page 44: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/44.jpg)
Page | 44© 2017 Mage Titans
• Restocked products go live on Magento much more quickly
• Errors importing one order no longer stops all other orders from importing
• It just works – no longer have to think about the ERP integration
Faster, More Reliable Syncing
![Page 45: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/45.jpg)
Page | 45© 2017 Mage Titans
• This integration would’ve taken substantially longer if not for the design patterns and architecture of Magento 2
• Code is cleaner, easier to maintain and more robust thanks to following the Magento 2 architecture
Impact of Magento 2
![Page 46: Magento 2 ERP Integration Best Practices: Microsoft Dynamics](https://reader034.vdocument.in/reader034/viewer/2022051404/5a64a37a7f8b9a8e568b4fa9/html5/thumbnails/46.jpg)
@JoshuaSWarren / Creatuity.com
Questions?