sfdcQuery

Use the Salesforce Object Query Language (SOQL) to search your Salesforce data for specific information. 

Description

Returns all the results in a single response as a json string, or if needed, returns part of the results and an identifier used to retrieve the remaining results.


Is the equivalent of a Select SQL statement or the analog of the Jira JQL. This search enables you to get the list of information about Salesforce objects in a json format (not the value or object directly) which you can use to fill out fields in Jira using a script.

SOQL supports get functionality with attachments and statuses.

Syntax

sfdcQuery(sfdcConnection, soqlQuery, [sfdcAPIVersion])

Parameters

Parameter

Type

Required

Description

Parameter

Type

Required

Description

sfdcConnection

SFDCConnection

Yes

Salesforce Connection - it is the object resulted from the call to the connectToSalesforce function.

sfdcQuery

string

Yes

SOQL query, see more information in the Salesforce documentation.

sfdcAPIVersion

string

No

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.

Return type

JSON string

Example

The first part of the example will get the names of the accounts from Salesforce and the second part will get ID and names of the Salesforce opportunities.

SFDCConnection conn = connectToSalesforce("SFDC_test"); logPrint("WARN", "Connected to SF: " + conn.instance_url + " - " + conn.access_token); string result = sfdcQuery(conn, "SELECT name from Account"); logPrint("WARN", "SOQL result: " + result); string result2 = sfdcQuery(conn, "SELECT id, name from Opportunity"); logPrint("WARN", "SOQL result: " + result2);

See also