I’m working with custom modules in SuiteCRM and I want to add insights in detail view,
same as how we have it on Opportunities module
I haven’t been able to find a straightforward way to integrate insights into custom modules. Does anyone have experience with this or know the steps required to achieve it?
I think if we add ‘sidebarWidgets’ section in our custom module, Insights button will appear. The actual statistics chart can be added if we follow the steps implemented in existing modules.
We can refer existing code from the Accounts module.
There is sidebarWidgets section in detailviewdefs.php and listviewdefs.php in \public\legacy\modules\Accounts\metadata\detailviewdefs.php
with a chartKey value (accounts-past-years-closed-opportunity-amounts)
We have the corresponding data handler for the statistics in \core\modules\Opportunities\Statistics\Series\PastYearsClosedOpportunityAmounts.php
with key having the chartKey (accounts-past-years-closed-opportunity-amounts)
and implement getData() method that returns Statistic object.