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


# Syntax

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

## Description

> Macro (excerpt)
> 
> Updates an opportunity from the Salesforce environment.

The update will be performed only for the fields specified in the **sfdcOpportunity** object sent as a parameter, the rest of the fields will remain unchanged.

## 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. |
| sfdcOpportunityId | string | Yes | ID of the Salesforce opportunity to be updated. |
| sfdcOpportunity | [SFDCOpportunity](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482806) | Yes | Structure containing the fields of the opportunity to be updated. |
| sfdcAPIVersion | string | No | Salesforce API version to be called when creating the opportunity, it should have the following format: "vXX.X" - eg: "v43.0", "v42.0".   
It is not required and if empty, the latest available version will be used. |

## <span style="color: #bd5528">Return type</span>

string - You can safely ignore the return value of this function.

## Example

The following example will update Opportunity fields in Salesforce.

```
SFDCConnection conn = connectToSalesforce("SFDC_test");
logPrint("WARN", "Connected to SF: " + conn.instance_url + " - " + conn.access_token);

SFDCOpportunity opp;
opp.Name = "Updated using function v2";
opp.CloseDate = currentDate();

sfdcUpdateOpportunity(conn, "opportunity ID", opp);
```

## See also

> Macro (contentbylabel)