This week Clemente Raposo, Lead Developer of SuiteCRM, takes you through the process of adding Service Decorators to SuiteCRM 8 core services.

Service Decorators are a convenient mechanism to extend core classes. In comparison with regular extensions, they have the advantage of allowing you to add many to the same class.  This allows for multiple extensions to decorate the same class without having to know about each other, making it an ideal strategy to use as an extension and in plug-ins.

In today’s example, we are going to demo an alternative solution to adding custom entries to the module menu in the navigation bar using service decorators.

For those of you who are ready to get started right away, below you will find the code sample from the video.

Copy to Clipboard

public/legacy/custom/Extension/modules/Cases/Ext/Language/en_us.create-critical-error.php

Copy to Clipboard

extensions/defaultExt/backend/Navbar/CreateCriticalCaseDecorator.php

Copy to Clipboard

extensions/defaultExt/config/services.yaml

Copy to Clipboard

extensions/defaultExt/modules/Cases/Service/Create/CaseCreateCriticalError.php

This sample can be used as an example to add your own Service Decorators based extension in SuiteCRM 8.  In addition, you can learn more about them here

If you are looking for more development insights, the Development Team here at SalesAgility have created instructor-led master classes.  Designed For developers, covering both SuiteCRM 8.x and SuiteCRM 7.x, head over to the MasterClasses to find out more.

About SuiteCRM

SuiteCRM is one of the world’s most popular CRM applications. Our feature-rich enterprise-ready alternative to Salesforce enables your sales teams to sell, market & service smarter. Providing all the benefits of CRM at substantially lower costs, with the freedoms and flexibility of Open Source.

You can download and host SuiteCRM on your own servers, in the public cloud / private cloud or try our SAAS offering SuiteCRM Hosted. It is the ultimate freedom, allowing you to stay in full control over your business data. Try SuiteCRM for free here.

Help support the SuiteCRM project by becoming a sponsor today!