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


# Syntax

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

## Description

> Macro (excerpt)
> 
> Retrieves data related to an opportunity from the Salesforce environment.

## <span style="color: #bd5528">Parameters</span>

| 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 retrieved. |
| sfdcAPIVersion | string | No | Salesforce API version to be called when creating the opportunity, 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. |

## Return type

[SFDCOpportunity](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15482738) (predefined type)

## Example

The following example will retrieve information about the opportunity ins Salesforce.

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

SFDCOpportunity opp;

opp = sfdcGetOpportunity(conn, "opportunity ID", "v43.0");
logPrint("WARN", "Retrieved opportunity: " + opp.Name);
```

  


## See also

> Macro (contentbylabel)