Phone

Contact sales: +1 (833) 441 7687

What is a Bot User error and how does Gearset fix it?

Jan Letovanec on August 13th 2021


Gearset helps make sure your deployments succeed on your first attempt. We do this by running the deployment through more than 60 problem analyzers that check for and resolve common deployment issues for you. Our problem analyzers do a lot of useful work to make sure the average deployment success rate for our users remains above 90% by fixing these issues.

One such issue the problem analyzers look for is the Bot User error. This error relates to deploying Einstein bots, and was flagged up to us by a user.

What is a Bot User error?

The Salesforce API checks that any objects referenced by a field actually exist. In particular, if you (or Salesforce) say that something refers to Users, it will check whether a user you have specified is actually in Users.

Bots have a special field called BotUser, which you can optionally set to one of the Users of your org. If you then try to deploy this bot via Gearset, the user you have specified might not be in the target. If the user is missing, Salesforce won't accept the new bot and the deployment will fail, triggering the following Salesforce error message: Invalid value for Bot User field given.

How Gearset identified the problem

First steps towards fixing a problem usually involve recreating it. Luckily, in this case, that was a fairly easy procedure:

  1. We first enabled bots in both our source and target orgs (Setup -> Feature settings -> Service Cloud Einstein).
  2. We then created a bot in our source org, which opened up a new screen.
  3. In the Overview screen, we specified a Bot User. The user you specify must be in Users of your source org. Failed deployment of the bot
  4. In Gearset, we ran a comparison, making sure that Bot was included in the metadata filters. We then selected the item from the comparison view and started a deployment, which promptly triggered the problem analyzer that's designed to catch this problem: Failed deployment of the bot
  5. Finally, we unchecked all the fixes Gearset suggested, which resulted in the error message we wanted to see when we deployed: Failed deployment of the bot

How does Gearset fix this error?

Knowing how the error works, the solution that first comes to mind is simply not to deploy the BotUser field. But that won't work because, if we don't specify any BotUser, Salesforce assumes we want to delete whatever BotUser is on the target. Notice that deleting a BotUser is therefore a completely valid operation and could trip you up because it won't trigger the problem analyzer.

So instead of deleting the BotUser, Gearset's solution is for the problem analyzer to copy the BotUser from the target. As a result, unless you are trying to delete BotUser, Gearset won't change it, allowing the deployment to succeed.

Okay, but what does it mean for me?

If you're trying to deploy a bot, Gearset will alert you to this on the problem analyzer page:

Failed deployment of the bot

It will tell you that the problem is related to the BotUser field and will also list all bots that are trying to override the BotUser in your target.

If you leave the checkboxes checked, Gearset will automatically fix the issue and your deployment will succeed. Without this problem analyzer, you would have to manually set the BotUser field each time, and your deployments would fail.

Got feedback on Gearset's problem analyzers?

We are constantly adding new analyzers and improving the existing ones to keep your deployments running smoothly. We'd love to know if there is something you'd like to see or something you think could be improved. Drop us a message on our in-app chat, leave a feature request on our feedback forum, or email [email protected]!

Ready to get started with Gearset?

  • Free 30-day trial
  • No credit card required
  • Nothing to install in your orgs
Start free trial
  • Free 30-day trial
  • No credit card required
  • Nothing to install in your orgs