Error overview
When deploying a Dashboard component, the validation can fail with the following error returned by Salesforce:
You reached the limit for dashboards run as the logged-in user.
This error means the deployment is trying to create or update a dynamic dashboard in the target org, but the target org has already reached its limit of dynamic dashboards.
A dashboard is dynamic when its running user is set to the person viewing it, rather than a single specified user. In the Dashboard metadata XML, this is controlled by the dashboardType element:
SpecifiedUser- a standard dashboard. Doesn't count towards the limit.LoggedInUser- runs as the person viewing the dashboard. Counts towards the limit.MyTeamUser- runs as the logged-in user, with the option to change the running user. Counts towards the limit.
Salesforce limits the number of dynamic dashboards per org based on the Salesforce edition:
Salesforce edition | Dynamic dashboard limit |
Developer | 3 |
Enterprise | 5 |
Unlimited and Performance | 10 |
Because Gearset deploys using the Metadata API, Salesforce enforces this limit at validation time. The Dashboard component fails validation, but the rest of the package isn't affected unless other components depend on the dashboard.
How to check which dashboards count towards the limit
Run the following SOQL query against the target org, for example using the Developer Console or Salesforce Inspector:
SELECT Id, Title, DeveloperName, Folder.Name, Type FROM Dashboard WHERE Type != 'SpecifiedUser'
This lists every dynamic dashboard currently using up the org's allowance.
How can we resolve this deployment failure?
Option 1 - Free up a slot in the target org
Delete any dynamic dashboards that are no longer needed, and permanently remove them from the recycle bin. Alternatively, convert an existing dynamic dashboard to a standard dashboard by opening it in the target org, editing the dashboard properties, and setting View dashboard as to A specified user. Once a slot is free, re-run the validation in Gearset.
Option 2 - Deploy the dashboard as a standard dashboard
If the dashboard doesn't need per-viewer data visibility, change it to a standard dashboard in the source before deploying. In the Dashboard metadata XML, set:
<dashboardType>SpecifiedUser</dashboardType> <runningUser>user@example.com</runningUser>
If you're deploying through Pipelines, make this change on your feature branch and re-validate the pull request.
Note: this changes the dashboard's behavior. Every viewer sees data as the specified running user, rather than filtered by their own access. Check with the dashboard owner before making this change.
Option 3 - Ask Salesforce to raise the limit
Salesforce can sometimes increase the dynamic dashboard allocation for certain editions. The org owner needs to contact their Salesforce account executive or raise a case with Salesforce support.
Option 4 - Deploy the rest of the package now
If you need the other components deployed straight away, deselect the Dashboard component from your package in Gearset and redeploy. You can deploy the dashboard separately once a dynamic dashboard slot is available in the target org.
If none of these options suit your use case, check with our Customer Support Engineering team via our in-app chat who can investigate this error in more detail.
Useful resources
Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.
