Create a Salesforce Entity
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Tokens,Connectors
Creates a new record in Salesforce, for example a lead, a case, a contact or an account. You pick the object type, then map each Salesforce field to a value. The action signs in with a Salesforce connector and can save the new record's ID in a token.
This action is part of the Salesforce add-on (DnnSharp.Salesforce). The add-on is installed separately and needs the SALESFORCE feature in your license. If it isn't licensed, the action fails with a "not licensed" error. If you don't see the Salesforce actions, the add-on isn't installed.
Typical Use Cases
- Create a lead in Salesforce when someone submits a contact form
- Open a case from a support request and save its ID for later actions
- Create a record of a custom object, for example
Project__c - Create a lead, then add it to a campaign with Add to campaign
Don't use it to
- Change or upsert a record that already exists. The action only inserts new records. It has no external ID or update option.
- Check whether a record exists. Use Run SOQL Query first, then add a condition to this action.
- Create several records at once. It creates one record per run. Use it inside a Repeat for a list.
Related Actions
| Action Name | Description |
|---|---|
| Run SOQL Query | Looks up Salesforce records, for example to check for a duplicate first. |
| Add to campaign | Adds a lead to Salesforce campaigns, using the ID this action returns. |
| Add Salesforce Connector | Creates the Salesforce connector this action uses. |
| Update Salesforce Connector | Changes the login details of a Salesforce connector. |
| Test Connector | Checks that a connector can sign in. |
| Create a Salesforce Entity (obsolete) | The older version that stores the login details in the action. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Connector | The Salesforce connector to sign in with. See Add Salesforce Connector. When using an expression, the value must be the connector ID. | Yes | none | Yes |
| Salesforce Entity Type | The Salesforce object to create a record of. The list has Lead, Case, Contact and Account. To use another object, switch to an expression and type its API name, for example Opportunity or Project__c. | Yes | none | Yes |
| Salesforce Assignment Rule Name | The name of the assignment rule to apply. Only used for Lead and Case. If it's empty, the object's active rule is applied. See Assignment rules. | Yes | empty string | No |
| Fields | The fields to set. Salesforce Field is the field's API name, for example LastName or Region__c. Value is the value to save, for example [LastName]. Both columns support tokens. See Field values. | Yes | empty | Yes |
| Output Entity's ID Token Name | The name of a token to save the new record's ID in, for example LeadId. Brackets are optional. | No | empty string | No |
| Output Entity's URL Token Name | The name of a token to save a link to the new record in. See Output Parameters Reference. | No | empty string | No |
| On Error | Actions to run when the action fails. The [ErrorMessage] token holds the error message. | No | empty | No |
Output Parameters Reference
| Parameter | Description |
|---|---|
[<Output Entity's ID Token Name>] | The ID of the new record, an 18 character Salesforce ID. It's only set when Output Entity's ID Token Name has a value. |
[<Output Entity's URL Token Name>] | The connector's Login Url, exactly as entered, followed by / and the new record's ID. It's only a working link when Login Url is your Salesforce domain, for example https://yourcompany.my.salesforce.com, without a trailing / or the /services/oauth2/token path. If Login Url is empty, it's just / and the ID. |
[ErrorMessage] | The error message, set when the action fails. |
How it works
- The action signs in to Salesforce with the connector.
- For Lead and Case, it finds the assignment rule to apply. See Assignment rules.
- It reads the object's field list from Salesforce, to learn each field's type.
- It replaces tokens in the field names and values, and converts the values to the field types.
- It creates the record and saves the ID and URL tokens.
Field values
Each value is text after tokens are replaced. Salesforce doesn't fill in the fields you don't list, apart from its own defaults.
The action converts a few field types before it sends them. Everything else is sent as text:
| Salesforce field type | What to enter | Example |
|---|---|---|
| Text, Email, Phone, URL, Text Area | Any text | [Email] |
| Number (integer) | A whole number | 25 |
| Number (decimal) | A number | 12.5 |
| Checkbox | true or false, or 1 or 0 | true |
| Date/Time | A date and time. The ISO format with a time zone is the safest. | 2026-09-27T14:30:00Z |
| Date | Sent as text. Use YYYY-MM-DD. | 2026-09-27 |
| Currency, Percent | Sent as text. Use a plain number, without symbols or thousands separators. | 1500.50 |
| Picklist | Sent as text. Use the value's API name, not a translated label. | Web |
| Multi-select picklist | Sent as text. Separate values with semicolons. | Email;Phone |
| Lookup, Master-Detail | The ID of the related record | [AccountId] |
Keep these in mind:
- Values that can't be converted don't raise an error. An empty or invalid number becomes
0, and an empty or invalid checkbox value becomesfalse. An empty or invalid date and time becomes0001-01-01, which Salesforce rejects. Check your tokens, or leave the row out, when a value may be empty. - Field names aren't case sensitive when the action looks up the type. A field name that doesn't exist on the object is sent as it is, and Salesforce rejects it.
- Don't list a field twice. Each field name must be unique.
Assignment rules
For Lead and Case records, the action always asks Salesforce to run an assignment rule:
- If
Salesforce Assignment Rule Namehas a value, the action looks up the rule with that name for the object and applies it. - If it's empty, the action applies the object's active assignment rule.
- If no rule is found, Salesforce applies its default rule, if one is set.
There's no way to turn assignment rules off for Lead and Case from this action. For other objects, Salesforce Assignment Rule Name is ignored.
Errors
When the action fails, [ErrorMessage] is set. If Salesforce returns several errors, they're joined with <br />.
- If
On Errorhas actions, they run and the action doesn't raise an error. - If
On Erroris empty, the action raises an error:Failed to post to salesforce:followed by the error message. End users seeFailed to post to salesforce.
Common errors are a wrong login in the connector, no connector selected, a missing required field, a field name that doesn't exist, and a picklist value that isn't allowed. Errors are also written to the event log.
Considerations
- Required fields depend on the object. For example, a lead needs
LastNameandCompany. Salesforce rejects the record if a required field is missing. Check the object's setup in Salesforce. - Use API names. Field and object names must be the API names, not the labels. Custom fields and objects end in
__c. - The connector's user decides what's allowed. The record is created as the Salesforce user in the connector, with that user's permissions and field access.
- The URL token is often not a working link. It's built from the connector's Login Url, not from your org's address. If Login Url is empty or is
https://login.salesforce.com, build the link yourself from your Salesforce domain and[<Output Entity's ID Token Name>]. - No duplicate check. Running the action twice creates two records, unless a Salesforce duplicate rule blocks it. Look for an existing record first with Run SOQL Query.
- Test the connector first. Use Test Connector to check that the login works before you debug field errors.
- Sandbox orgs use a different login domain. Set it in the connector's Login Url, for example
https://test.salesforce.com.
Examples
To understand how to use the below examples, please see Running Examples.
1. Create a lead from a contact form
This action creates a lead from form values and saves its ID in [LeadId]. The active lead assignment rule is applied. Replace the connector ID with your Salesforce connector.
{
"Title": "Create a Salesforce Entity",
"ActionType": "CreateAnEntityWithCredentialStore",
"Description": "Create the lead in Salesforce",
"Parameters": {
"Credentials": {
"Entry": "00000000-0000-0000-0000-000000000000"
},
"sforceEntityType": "lead",
"sforceAssignmentRuleName": "",
"Fields": [
{ "name": "FirstName", "value": "[FirstName]" },
{ "name": "LastName", "value": "[LastName]" },
{ "name": "Company", "value": "[Company]" },
{ "name": "Email", "value": "[Email]" },
{ "name": "LeadSource", "value": "Web" },
{ "name": "HasOptedOutOfEmail", "value": "false" }
],
"SOQLEntityIDTokenName": "LeadId"
}
}
2. Create a custom object record with error handling
This action creates a Project__c record linked to an account, but only when ProjectName isn't empty. The connector ID is in the [SalesforceConnectorId] token. If Salesforce rejects the record, the error is written to the log.
{
"Title": "Create a Salesforce Entity",
"ActionType": "CreateAnEntityWithCredentialStore",
"Description": "Create the project in Salesforce",
"Condition": "[ProjectName] != \"\"",
"Parameters": {
"Credentials": {
"IsExpression": true,
"Entry": "[SalesforceConnectorId]"
},
"sforceEntityType": {
"IsExpression": true,
"Expression": "Project__c",
"Value": ""
},
"Fields": [
{ "name": "Name", "value": "[ProjectName]" },
{ "name": "Account__c", "value": "[AccountId]" },
{ "name": "Start_Date__c", "value": "[StartDate]" },
{ "name": "Budget__c", "value": "[Budget]" }
],
"SOQLEntityIDTokenName": "ProjectId",
"OnError": [
{
"Title": "Log Error",
"ActionType": "LogError",
"Parameters": {
"Message": "Salesforce project not created for [ProjectName]: [ErrorMessage]"
}
}
]
}
}
Revised 09/27/2026