I have a set of 2 reports, their associated 2 report folders, 2 dashboards, associated 2 dashboard folders.
When I try to deploy via Change Set all of these 8 components, I get this error specifically for the 2 dashboards:
Cannot find a user that matches any of the following usernames:
email@example.com; remove the user from
the component being deployed or create a matching user in the
I have no idea what is the issue.
I then tried to deploy the 6 components separately and it worked. So the issue seems to be with Dashboards.
I went into Dashboards and also set the Running User as “Run as specified user”. Then I created a separate Change Set for these 2 dashboard items and tried to validate it in destination sandbox. Still the same error.
Can anyone please advise what is the issue and how can I resolve this?
Remove the “run as specific user” completely from the dashboard prior to deployment (set the options to “Run as logged-in user”). Deploy, then change it back to whatever you need.
It tries to find an user by username (in XML of the dashboard definition the reference is stored by username, not by User Id or email). And obviously fails because in production you don’t have same sandbox suffix. Same happens when you try to deploy a report/dashboard that’s scheduled to be sent to some users or when email alert (from workflows) is being deployed…
Easiest fix is to remove these settings, deploy the “core” of dashboard and amend it manually in the target org.
Alternatively you can temporarily change the username in your target org to be same as the sandbox username (it shouldn’t cause login conflicts because the endpoint will still be either login.salesforce.com or test.salesforce.com)… but I believe you’ll hit the lockdown of allowed domain names in your production