Module Builder is a very useful and versatile part of Sugar. With Module Builder, Sugar administrators and developers have the ability to build custom modules to fulfill any needs that are not covered by the out-of-the-box Sugar modules (Accounts, Contacts, Opportunities, Cases, etc.). This article will cover the various options for working with the custom module package when it is finished being built in Module Builder.
After you have created your package and custom module in Module Builder, there are three buttons that can be selected to implement the module. Please note that each button option serves different purposes and produces different results.
The Deploy button is used when you want to make the package’s custom modules active and available within the Sugar instance in which it was built. Prior to deploying a module, you should ensure that it is complete and configured for your needs. Once the package is deployed, the custom module will be visible in Module Builder and Studio. The deployed custom module will also appear in Module Loader, so it can be uninstalled or disabled at a later time if it is no longer needed.
Any future configurations to the custom module should be performed via Studio after the package has been initially deployed. For more information on deploying packages, please refer to the article Best Practices When Building Custom Modules.
The Publish button allows you to migrate the custom module package to a different instance by creating a zip file, which can be installed. Examples of use cases calling for publication are:
- Developers building a custom module for a client and providing the package in a zip file to be installed in the client’s instance.
- Making customizations on a development environment and migrating the custom module package to the production environment once all testing is completed.
In order to use the custom module after it is published, you will have to upload and install the package using Module Loader. Once the custom module is loaded, the module will appear in Studio but not in Module Builder. You can make additional configurations to the custom module in Studio once the package has been installed. The package can be uninstalled via Module Loader at any time.
Both the Export and Publish options are similar since both create a zip file containing the customizations which can be migrated to another instance. Export, unlike the publish option where the module shows up in Studio once installed, will cause the custom modules appear in Module Builder to allow further editing. After uploading the exported package to the second instance via Module Loader, you can further customize the module as necessary in Module Builder and deploy it to your instance once it is ready to use. After deploying it from Module Builder in the second instance, Studio should be used to make any future changes.
The Save option allows you to store the changes made in your custom package without deploying the modules to be available for use in the instance.
The Duplicate option allows you to copy the modules in an existing custom module into a new package.
The Delete option allows you to remove the custom package and its modules from Module Builder.
If you need to remove custom modules, there are two places you can do this in Sugar. In Module Builder, you can simply click the “Delete” button. However, this will not remove active custom modules that have been deployed from this package in the instance. To completely remove active modules, you will need to uninstall the package via Admin > Module Loader. When you “Commit” to uninstall, all relevant files will be removed from the Sugar file system. You will also have the option to remove or retain the database tables for the custom module in Sugar’s database. By default, the “Remove Tables” is selected when uninstalling modules via Module Loader.