# Send a whole table to Salesforce

> Send every column of a table on your semantic model into Salesforce, one record a row, in an object Sanda creates for it or one you have.

A push can send a whole table from your semantic model into Salesforce: one Salesforce record a row, one field a column. You pick the table and the column that is different on every row, and Sanda creates an object for it in your org, with a field for each column. Or you send it into an object you already have.

After that it is an ordinary push. Each run sends only the rows whose values changed, a row Salesforce doesn't have yet becomes a new record, and a push never deletes a record.

## Before you start

- **A connected Salesforce org.** See [connect Salesforce](https://docs.sanda-os.com.au/streams/connect-salesforce).
- **The table on your semantic model.** The editor lists the tables on your [semantic map](https://docs.sanda-os.com.au/semantic-model/the-map). A table waiting for review isn't listed until you confirm it.
- **A column that is different on every row**, such as an order number or a line ID. Salesforce finds each row's record by it.
- **For a new object, a Salesforce user that may create one.** Sanda asks Salesforce to make the object and its fields as the user it connects as. See [connect Salesforce](https://docs.sanda-os.com.au/streams/connect-salesforce#before-you-start) for the permissions that takes.

:::caution Salesforce counts every record against your storage
Salesforce counts most records as about 2 KB of your org's data storage, however small they are. A summary table, such as sales by store and day or spend by customer, suits an object well. Every line of every sale may use more of your storage than you expect, so check your org's allowance before you send one.
:::

## Send a table

:::steps
1. **Open the editor.** Go to **Data · Streams · Push** and press **New push**, at the right of **Your pushes**, or the **Salesforce** card under **Choose a destination**.
2. **Choose the org.** Under **Where it writes**, pick the **Salesforce org**.
3. **Choose a whole table.** Under **What it sends**, **A whole table** is chosen for a new push.
4. **Pick the table.** Under **The table**, choose it in **Table**. **Different on every row** is filled in with the table's key where Sanda can tell which it is. Check it, and change it if it isn't the one. A push with no name yet takes one from the table too.
5. **Name the object.** Under **Into**, **A new object** is chosen. **Object name** starts as the table's name. The hint under it says what Salesforce will call the object, which always ends in `__c`, and how its records are named: a running number, such as `POS-0000001`.
6. **Choose the columns.** Under **Columns**, every column a Salesforce field can hold is ticked and shows the field it becomes, with its type. Untick any you don't want sent.
7. **Create the object.** Press **Create**, which names the object. Sanda makes the object and its fields in your org straight away, before you save the push, and gives the user it connects as access to them. A wide table can take a minute. When it is done, **Into** switches to the new object and every column is lined up with its field.
8. **Narrow the rows, if you need to.** Under **Filter the rows**, press **add a condition**. See [big tables](#big-tables).
9. **Choose when it runs, and save.** Set **When it runs**, check the **Name**, and press **Save push**. The push opens with **Preview the next run** already read, and nothing has been sent.
:::

Read the preview, then press **Run now** to send the first run.

## What each column becomes

| The column holds | Its Salesforce field |
|---|---|
| The key you chose under **Different on every row** | Text, marked External ID and unique, whatever the column's type. A number, a code with leading zeros and an ID are all found the same way |
| Text | Text, up to 255 characters, or the column's own length when it declares a shorter one |
| Text declared longer than 255 characters, or JSON | Long Text Area |
| Whole numbers | Number, with no decimal places |
| Numbers with decimal places declared, such as money to 2 places | Number, with the same places |
| Numbers with no places declared | Number, with 4 decimal places |
| True or false | Checkbox |
| A date | Date |
| A date and time | Date/Time |
| A time of day | Time |
| A list, or raw bytes | Not sent. The column starts unticked, and says why |

A value longer than its Text field holds is refused for that record, and the run says which.

Each field's name in Salesforce comes from the column's own name, so renaming the column's business term on the semantic map later leaves the field where it is. The object's name is the one you typed, at most 40 characters, with at least one letter in it.

## Who can see it in Salesforce

Salesforce shows a field made this way to nobody until someone is given access to it. So Sanda makes a permission set named after the object, gives it read, create and edit on the object and read and edit on each field, and assigns it to the user Sanda connects as. To let your own team see the object, a Salesforce admin assigns them the same permission set, or gives them access another way.

If Salesforce won't let that user make or assign a permission set, the object still stands, and the editor says what to give whom. A Salesforce admin can assign the permission set to that user, or give it access to the object and its fields directly, and then you save the push.

## Into an object you already have

Under **Into**, press **An object Salesforce already has** and choose the **Object**. Then:

- **Found by** is the field that finds each row's record. Sanda picks the External ID field whose name or label reads as your key column. When none does, it picks nothing, and you choose. Choosing the **Salesforce record Id** means the key column must hold Salesforce Ids, and the push only updates records that already exist.
- **Columns** lines each column up with the field whose name or label reads as the column's, ignoring case, spaces and underscores. A column with no such field isn't sent, and says so.
- For an object whose name ends in `__c`, **Add the missing fields** makes a field for each column that has none and, when **Found by** has no External ID chosen, one for the key column. Sanda never adds fields to a standard object such as Account.

## Big tables

One push reads at most 50,000 rows a run, and refuses to run when its table holds more. For a bigger table, add a period under **Filter the rows**, such as the last 30 days on the sale's date. The window moves with each run, so each run sends the rows that are new or changed in it. A row that leaves the window keeps its record in Salesforce, because a push never deletes one.

One push writes at most 100 fields besides the key. For a wider table, untick the columns you don't need.

## If creating doesn't finish

| The editor says | What to do |
|---|---|
| The Salesforce user Sanda connects as can't create objects | Give that user the permissions under [connect Salesforce](https://docs.sanda-os.com.au/streams/connect-salesforce#before-you-start), or have a Salesforce admin create the object and choose it under **An object Salesforce already has** |
| Salesforce already has an object called this | Press **Send into it instead**, or give the new one another name |
| The object was started in Salesforce, and to press Create again | Press **Create again, carrying on**. Sanda makes only what is still missing |
| Salesforce made the object, but Sanda couldn't give the user access | Have a Salesforce admin assign the permission set the sentence names, then save the push |

:::links
- [Create a push](https://docs.sanda-os.com.au/streams/create-a-stream-out): Write chosen values onto records Salesforce already has.
- [Connect Salesforce](https://docs.sanda-os.com.au/streams/connect-salesforce): Sign in as the user Sanda writes as.
- [Runs](https://docs.sanda-os.com.au/streams/runs): What each run sent, and what it couldn't.
:::
