Hey!
I’ve had a look and, oddly enough, I’m also not able to limit the query by making a Custom version of that Dashlet in the /custom/ folder
There must be something else that connects or protects this dashlet’s content that I’ve not yet found
However, it looks like you might be able to make an identical Custom Dashlet, but with the limit included, if that sounds like a solution for you?
ie:
Copy:
modules/Campaigns/Dashlets/TopCampaignsDashlet/TopCampaignsDashlet.php
to:
custom/modules/Campaigns/Dashlets/TopCampaignsDashlet/
and rename it, ie:
custom/modules/Campaigns/Dashlets/TopCampaignsDashlet/LimitTopCampaignsDashlet.php
and update the Class name on line 49 accordingly in this new custom file,
(and feel free to change the query limit):
Then do the same for the metadata file:
Copy:
modules/Campaigns/Dashlets/TopCampaignsDashlet/TopCampaignsDashlet.meta.php
to:
custom/modules/Campaigns/Dashlets/TopCampaignsDashlet
and rename it similarly, ie:
custom/modules/Campaigns/Dashlets/TopCampaignsDashlet/limitTopCampaignsDashlet.meta.php
In this new xxxx.meta.php file, make some changes to differentiate it from the core Top Campaigns.
ie, I’ve changed the content of the file to the below:
global $app_strings;
$dashletMeta['limitTopCampaignsDashlet'] = array('module' => 'Campaigns',
'title' => translate('LBL_LIMIT_TOP_CAMPAIGNS', 'Campaigns'),
'description' => translate('LBL_LIMIT_TOP_CAMPAIGNS_DESCRIPTION', 'Campaigns'),
'category' => 'Module Views');
(This changes the dashletMeta link as well as the two labels used)
Then, create a file at:
custom/modules/Campaigns/language/en_us.lang.php
And add these two language files, ie:
<?php
$mod_strings['LBL_LIMIT_TOP_CAMPAIGNS'] = 'Limited Top Campaigns';
$mod_strings['LBL_LIMIT_TOP_CAMPAIGNS_DESCRIPTION'] = 'Limited Top Campaigns';
After running a “Quick Repair and Rebuild” and “Rebuild SuiteCRM Dashlets”
You should see this new dashlet as an option on the Homepage, but let me know if you run into any issues!
From here, you should be able to make any changes you want to the query in the
“LimitTopCampaignsDashlet.php” file, (including limiting to one result), which then should be reflected in the CRM
Hopefully something like the above can help at all!