# Add a project to CodeScan from Salesforce

This document guides how to add a Salesforce project to your [CodeScan cloud](https://www.codescan.io/products/cloud/) account and run the analysis.

1. Login into your CodeScan account.
2. Once you log into your CodeScan account, click the **`+`** icon in the top right corner and select **`Analyze new project`**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fnh9THtlrbUmTok0LXPgU%2FAnalyzeProzect%205.9.png?alt=media&#x26;token=0a1b9249-02ff-4df6-a098-c14620c3a74c" alt=""><figcaption></figcaption></figure>

3. It takes you to a different window. Choose the **`Organization`** for which you'd like to create a project. Click **`Set Up`**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FzWZgUN5f3zdjsqd0irz2%2FProjectSetup%207.7.png?alt=media&#x26;token=6ae0d1b3-ad56-48ac-9d66-211d36e5642f" alt="" width="563"><figcaption></figcaption></figure>

4. In the next window, click on **`Add Analysis Project`** option.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FvcWiKPk3QSrDzM8uvxiF%2FAnalysis%20Project%206.1.png?alt=media&#x26;token=7b7d8383-166c-45e9-8115-216eac4d6f22" alt=""><figcaption></figcaption></figure>

5. You will now see a new popup window; select **`Salesforce`** from the given options.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FtO4myqylO1bTsUrLYqeI%2FSF%206.2.png?alt=media&#x26;token=bed78857-12b1-4982-85fd-198eec8179c9" alt=""><figcaption></figcaption></figure>

6. Next, choose the environment from the dropdown between _**Production/Developer**, **My own domain**, and **Sandbox**_.

* **`Production/Developer:`** Production/Developer refers authenticating users to Salesforce.com for a Developer account and/or a  Production account using the username and password at [_login.salesforce.com_](https://login.salesforce.com/)_._
* **`Sandbox:`** Sandboxes are test environments that provide a way to copy and create metadata from a production org (above).  It is a separate environment where you can test (including seeding with data). There are four different types of sandboxes, accessed at [_test.salesforce.com_](https://test.salesforce.com/)_._
* **`My own domain:`** Choose this if you have set up your domain or custom URL to access your Salesforce org rather than [_https://login.salesforce.com_](https://login.salesforce.com/). Next, specify the Salesforce login URL in the text box. For example, _https://mydomainname.my.salesforce.com_. Companies and admins can better manage login and authentication for their Salesforce orgs by creating a custom domain.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FkFZAYEsR3nLA04XG6XmR%2FEnvironment%206.3.png?alt=media&#x26;token=dfab92a9-5ce0-45b9-bfc5-54df13d5d7a4" alt="" width="563"><figcaption></figcaption></figure>

7. Click on **`Authorize`**. It will redirect to the Salesforce login page. Validate your credentials and click on **`Login`**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FPslCRdMa8HVQjyYtJZyz%2FAuthorize%206.4.png?alt=media&#x26;token=af89692d-4ec2-437a-834f-a2bb995867e3" alt="" width="563"><figcaption></figcaption></figure>

8. You will be redirected back to the CodeScan app.
9.  In **CodeScan**, on **`Add a new project`** screen, fill in the below details:

    * The **`project key`** and the **`project name`** are auto-assigned. You can edit the fields as per your need.Note:To know where to find the project key, refer to our document on how to do it by clicking [HERE](../../setting-up-a-codescan-cloud-organization/finding-your-project-key).
    * Enter the project version under the **`Default Project Version`** field.
    * Choose the **`Unit Test Mode`** from the dropdown. This allows you to configure which unit tests are run by the analysis. Example, _Run Unit Tests, Use Previous Run, or_ keep it in _disabled_ mode
    * Under **`Scheduling`**, you can set the time frame for the analysis to run. You can run the project automatically by selecting _Daily_ or manually by selecting _Manual_. If you select _Daily_, another field named _Schedule_ has to be selected by choosing the time you want the automatic analysis to be triggered.

    <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Ff4o0U5KsAneliNrYK7Se%2FAdd%20SF%20Project.png?alt=media&#x26;token=58fe1da4-ee7c-46f6-a5c4-62ce9599b327" alt="" width="375"><figcaption></figcaption></figure>
10. Click **`Add and Run Now`**. This triggers the project analysis and the added project under your [CodeScan](https://www.codescan.io/) organization.
11. You'll be redirected to the **`Project Analysis`** screen to view the status of your analysis triggered.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FQ2pWQIS6uOfXWTaRqFrX%2FSF%20Analysis%206.6%20.png?alt=media&#x26;token=a46d40b0-08de-4f18-b614-49f927e9d930" alt=""><figcaption></figcaption></figure>

12. View the log report by clicking on more icon drop-down and selecting **`Logs`**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FAk9DrIR4e2ac2LqCrkW5%2FSF%20Logs%206.7.png?alt=media&#x26;token=26a46fde-59b8-44cc-a032-5c3b26295df5" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fvvk19qTMGL5YLpUQMSd7%2FLogs%206.8.png?alt=media&#x26;token=6907211b-25f3-42cc-a2d3-fcf5c2c894fa" alt=""><figcaption></figcaption></figure>

#### Troubleshooting

**"ip restricted" error:** If your scan fails with the IP restricted error, please refer to the [Troubleshooting article](https://knowledgebase.autorabit.com/fundamentals/faq/codescan-faqs/codescan-cloud-issues/cloud-errors-and-solutions#why-am-i-getting-an-ip-restricted-message).
