# Salesforce NLPs and queries

> The 19 Salesforce-specific NLPs — sign-in, records, fields, and listview tables — plus the SOQL step and Query Builder.

Salesforce testing has 19 NLPs of its own, available in no other application type. They read the metadata synced from your org, so a step can name an object, a field, or a connection directly instead of navigating the UI to reach it. There are also 2 ways to query Salesforce data from a test.

Before you use any of them, the org needs a metadata connection. See [Set up Salesforce testing](https://testsigma.com/docs/v2/application-types/salesforce/setup/).

## Sign in and navigate

| NLP | What it does | Inputs |
|---|---|---|
| `Login to Salesforce Application application using Salesforce Connection connection` | Signs in to the configured instance with a chosen application and user connection | Salesforce Application, Salesforce Connection |
| `Login to Salesforce using Salesforce Connection` | Signs in with a chosen user connection. This is the default NLP for a test case | Salesforce Application |
| `Switch to Salesforce Application application` | Switches to the application you select | Salesforce Application |
| `Navigate to Salesforce tab` | Moves to a tab within the same application | Salesforce Tab |

## Work with records

| NLP | What it does | Inputs |
|---|---|---|
| `Create record in Salesforce Object Form using Salesforce Connection connection and store the record id in variable test data` | Creates a record through the create record API and stores its `RECORD_ID` in a variable | Salesforce Connection, Salesforce Object Form, variable |
| `Update record in Salesforce object form where record id is test data using Salesforce connection connection` | Updates a record through the update record API | Salesforce Connection, Salesforce Object Form, `RECORD_ID` |
| `Open the create Salesforce Object record form` | Opens the create record form on the selected tab | Salesforce Object |
| `Open the edit Salesforce Object form where record id is Record ID` | Opens the edit form for a specific record on the selected tab | Record ID, Salesforce Object |
| `Open the Salesforce Object details page where record id is Record ID` | Opens the record's view page on the selected tab | Record ID, Salesforce Object |
| `Delete record in Salesforce Object where record id is test data using Salesforce Connection connection` | Deletes a record through the delete record API | `RECORD_ID`, User Connection, Salesforce Object |
| `Get record details from Salesforce Object Form for RECORD_ID test data using Salesforce Connection connection` | Fetches a record's details for the selected object fields. Variables and verifications can be added straight from the response body | Salesforce Object Form, `RECORD_ID`, Salesforce Connection |
| `Store the recordID from details page into variable` | Captures the record ID from the details page currently displayed and saves it to a runtime variable during execution, for later steps to use | Record ID, variable |

## Work with fields

| NLP | What it does | Inputs |
|---|---|---|
| `Select multiple options using value test data in the element multipicklist` | Selects values in a multipicklist | Test Data, Element |
| `Remove multiple options using value test data in the element multipicklist` | Removes values from a multipicklist | Test Data, Element |
| `Undo field in element` | Undoes the update on the selected field | Element |
| `Enter test data in the element richInput text box` | Enters text into a rich input textbox | Test Data, Element |
| `Select option test data from element picklist` | Selects an option from a picklist | Test Data, Element |
| `Search test data on element lookup` | Searches within a lookup field | Test Data, Element |
| `Clear and enter test data in the element field` | Clears whatever is in the field, then enters the test data | Test Data, Element |

The multipicklist, undo, rich input, lookup, and picklist NLPs can be recorded rather than typed.

Every value in a multipicklist NLP has to match the criteria, or the step does not behave as expected.

## Work with listview tables

Table NLPs act on a Salesforce listview, a virtual table whose cells behave differently from one another: some are editable, some are dropdowns, some hold checkboxes. They act on those cells directly rather than through generic clicks.

Create a table element before using a table NLP. Without one, the step fails at execution.

Add table NLPs the same way as any other step, from the Test Case Details page.

## Query Salesforce data

Two features run SOQL against your org, and which you use depends on whether you want to write the query yourself.

### SOQL as a test step

A SOQL step retrieves live Salesforce data during a run, so a test can verify values in real records and reuse them in later steps.

1. Open the test case, click the step options list, and select **SOQL**.

2. Select a connection from **Salesforce Connection**, or parameterize it.

3. Enter the query in the editor and click **Run Query**.

4. Read the response on the **Table**, **Outline**, or **JSON** tab.

5. On the **Outline** tab, store values as variables or add verifications from the response.

6. Click **Create** to add the step to the test case.

A query looks like this:

```sql
SELECT Id, Name, Phone, Industry, BillingCity, BillingState
FROM Account
WHERE Industry = 'Technology' AND BillingState = 'CA'
ORDER BY Name
LIMIT 50
```

### Query Builder

Query Builder assembles the same SOQL without writing it, and previews the query as you go.

1. Open **Salesforce Query Builder** from the utility panel on the test case page.

2. Select the connection from **SF Connection**.

3. Choose a Salesforce object in **FROM**, such as `Account` or `Contact`.

4. Add fields in **SELECT**, such as `Type`, `RecordTypeId`, or `Industry`. The preview updates as you add them.

5. Click **+ Add Condition** to filter with a **WHERE** clause.

6. Set **ORDER BY** and **LIMIT** for the order and the number of records.

![Query Builder, with the connection, the object, and the field list for SELECT](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/soql_query_builder_4.1.png)
