====== Salesforce ======
===== General Overview =====
The Salesforce CRM connector lets you pull Salesforce data on an object level. The currently supported objects are:
* Account
* Lead
* Contact
* Task
* Opportunity
* Campaign
=== Sample query ===
Sample query:
https://connectors.windsor.ai/salesforce?api_key=(your API key)&date_preset=last_7d&fields=contact_firstname,contact_lastname,contact_email,contact_phone&_renderer=csv
===== Frequently asked questions =====
==== How to work with dates in the Salesforce connector? ====
* **Relative** \\ Filter for a relative date range in which the objects requested were last modified at (e.g. Contact Last Modified Date for any field related to Contacts). \\ Example: &date_preset=last_7d
* **Absolute** \\ Filter for an absolute date range in which the objects requested were last modified at (e.g. Contact Last Modified Date for any field related to Contacts). \\ Example &date_from=2021-01-01&date_to=2021-03-31
* **Not specified** \\ If neither absolute or relative date ranges are specified from the requested objects last modified in the last 3days (e.g. Contact Last Modified Date for any field related to Contacts) will be returned.
==== How to work with custom fields and custom objects? ====
In case your Salesforce instance has custom fields and custom objects you can also query them. The syntax is slightly different. First of all you would need to identify the ***API Name*** of the custom field. You can do so by navigating to Setup -> Customize -> Under any Standard Object -> Fields.
You can then find the API name
{{ :salesforce_custom_fields_api_name.png?nolink&200 |}}
Custom fields can be identified easily as they either end with "__c" or "__pc". The same rule applies for custom objects.
To build a query this way you specify the object name with square brackets followed by the field name.
Example:
[Campaign]External_Display_Name__c
Will retrieve the custom field External Display Name from the standard **Campaign object**.
[Sales_Order__c]TOTAL_Invoice_Price__c
Will retrieve the custom field **TOTAL Invoice Price** from the custom **Sales Order Object**.
The complete API URLs will look like this
https://connectors.windsor.ai/salesforce?fields=[Sales_Order__c]TOTAL_Invoice_Price__c,[Sales_Order__c]Opportunity__c,[Sales_Order__c]Account__c,[Account]Id,[Account]Mobile_Preferred__pc,[Account]Default_Email__c,[Opportunity]Id,[Opportunity]CampaignId,[Opportunity]AccountId&date_from=2021-03-01&date_to=2021-03-05&api_key=(your API key)
and the response would look similar to this:
"data": [
{
"[account]default_email__c": null,
"[opportunity]campaignid": "campaign id",
"[account]id": null,
"[account]mobile_preferred__pc": null,
"[sales_order__c]opportunity__c": null,
"[sales_order__c]account__c": null,
"[opportunity]accountid": "account id",
"[opportunity]id": "opportunity id",
"[sales_order__c]total_invoice_price__c": null
},
...