# Salesforce connection setup

## Prerequisites

* A Salesforce account

## Setting up the connection

1. In Salesforce, navigate to the "App Manager" section and create a new connected app. Enter the name and contact information for the app.
2. Enable OAuth settings and enter the callback URL `http(s)://YOUR_UIBAKERY_IP_OR_DOMAIN/salesforce-oauth-callback`.
3. In the "Selected OAuth Scopes" section, add all the necessary OAuth scopes. Make sure to include `access and manage your data` and `perform requests on your behalf at any time`. Even though `Full access` is an option, it's important to note that it doesn't grant all the necessary permissions.
4. Save the connected app and make a note of the Consumer Key (Client ID) and Consumer Secret (Client Secret).
5. Save Client ID and Client Secret to the `UI_BAKERY_SALESFORCE_CLIENT_ID` and `UI_BAKERY_SALESFORCE_CLIENT_SECRET` environment variables and restart the docker container.
6. In UI Bakery, create a new Salesforce data source and enter the Salesforce URL.
7. Test the connection to ensure it is successful.

## Troubleshooting

* If you encounter an error message when testing the connection, double-check that the callback URL and OAuth scopes are correctly configured in Salesforce.
* Make sure your Salesforce instance URL ends in `.salesforce.com`
* Make sure that the correct permissions are granted to the connected app


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/on-premise/additional-configurations/salesforce-connection-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
