---
title: "sfdcCreateAccount"
canonical: "https://support.appfire.com/space/PSJ/15482541/sfdcCreateAccount"
format: markdown
---
> Macro (aura-html)


# Syntax

<span style="color: #3366ff">**sfdcCreateAccount(sfdcConnection, sfdcAccount, [sfdcAPIVersion])**</span>

## Description

> Macro (excerpt)
> 
> Creates an account in the Salesforce environment.

  


## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| sfdcConnection | [SFDCConnection](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482612) | Yes | Salesforce Connection - it is the object resulted from the call to the **connectToSalesforce** function. |
| sfdcAccount | [SFDCAccount](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482944) | Yes | Structure containing the [fields](#SFDCAccount fields) of the account that will be created. This is a predefined structure type described below. When creating an account, only the **Name** field is required. |
| sfdcAPIVersion | string | No | The Salesforce API version to be called when creating the account, it should have the following form: "vXX.X" - eg: "v43.0", "v42.0".   
It is not required and if empty, the latest available version will be used. |

  


### SFDCAccount fields

> ⚠️ **Note**
> ⚠️ 
> ⚠️ The **Name** field is required, the rest of the fields are optional. See [SFDCAccount](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482944) for more details.

## Return type

string - Salesforce Account ID

## Example

The following example will create an account in Salesforce with the specified fields.

```
SFDCConnection conn = connectToSalesforce("SFDC_test");

logPrint("WARN", "Connected to SF: " + conn.instance_url + " - " + conn.access_token);

SFDCAccount newAccount;
newAccount.Name = "Created with function";
newAccount.Description = "This is my new account";
newAccount.NumberOfEmployees = 312;
newAccount.Industry = "Phone production";

string accId = sfdcCreateAccount(conn, newAccount);
logPrint("WARN",  "Created account with id: " + accId);
```

## See also

> Macro (contentbylabel)