Skip to main content
Version: 1.28 (Current)

Create a Salesforce Entity

Audience: Low-code Engineers

Skill 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.

note

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.
Action NameDescription
Run SOQL QueryLooks up Salesforce records, for example to check for a duplicate first.
Add to campaignAdds a lead to Salesforce campaigns, using the ID this action returns.
Add Salesforce ConnectorCreates the Salesforce connector this action uses.
Update Salesforce ConnectorChanges the login details of a Salesforce connector.
Test ConnectorChecks 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​

ParameterDescriptionSupports TokensDefaultRequired
ConnectorThe Salesforce connector to sign in with. See Add Salesforce Connector. When using an expression, the value must be the connector ID.YesnoneYes
Salesforce Entity TypeThe 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.YesnoneYes
Salesforce Assignment Rule NameThe 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.Yesempty stringNo
FieldsThe 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.YesemptyYes
Output Entity's ID Token NameThe name of a token to save the new record's ID in, for example LeadId. Brackets are optional.Noempty stringNo
Output Entity's URL Token NameThe name of a token to save a link to the new record in. See Output Parameters Reference.Noempty stringNo
On ErrorActions to run when the action fails. The [ErrorMessage] token holds the error message.NoemptyNo

Output Parameters Reference​

ParameterDescription
[<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​

  1. The action signs in to Salesforce with the connector.
  2. For Lead and Case, it finds the assignment rule to apply. See Assignment rules.
  3. It reads the object's field list from Salesforce, to learn each field's type.
  4. It replaces tokens in the field names and values, and converts the values to the field types.
  5. 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 typeWhat to enterExample
Text, Email, Phone, URL, Text AreaAny text[Email]
Number (integer)A whole number25
Number (decimal)A number12.5
Checkboxtrue or false, or 1 or 0true
Date/TimeA date and time. The ISO format with a time zone is the safest.2026-09-27T14:30:00Z
DateSent as text. Use YYYY-MM-DD.2026-09-27
Currency, PercentSent as text. Use a plain number, without symbols or thousands separators.1500.50
PicklistSent as text. Use the value's API name, not a translated label.Web
Multi-select picklistSent as text. Separate values with semicolons.Email;Phone
Lookup, Master-DetailThe 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 becomes false. An empty or invalid date and time becomes 0001-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 Name has 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 Error has actions, they run and the action doesn't raise an error.
  • If On Error is empty, the action raises an error: Failed to post to salesforce: followed by the error message. End users see Failed 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 LastName and Company. 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​

tip

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