Connect Salesforce

A service account connects your project to Salesforce as one integration user, so Salesforce's own permissions decide what the integration's tools can read and change.

Before you start

You need a project. See Create a project.

Set up Salesforce

A Salesforce admin sets this up once per org.

PartSetting
Integration userUser licence Salesforce Integration, profile Minimum Access - API Only Integrations
Permission set licenceSalesforce API Integration, assigned to that user
Permission setOne, assigned to that user, with only the access below
AppAn External Client App with the client credentials flow, scope api, run as the integration user
ObjectAccessFields
AccountReadName, Type, Industry, Phone, Website
ContactReadName, Email, Phone, Title, Account
CaseRead, EditRead Subject, Description, Priority, Origin, Account, Contact; edit Reason, Type

Record sharing still applies: unless org-wide defaults allow it (Public Read Only for Account and Contact, Public Read/Write for Case), share the records with the user.

Case Edit always allows Status and Owner. To block them, add this validation rule on Case, with your integration user's username in place of [email protected]:

Text
$User.Username = "[email protected]" && (ISCHANGED(Status) || ISCHANGED(OwnerId))

Connect the service account

  1. Set PROJECT to your project's slug, from its address in Studio (/projects/<slug>): export PROJECT=<slug>.
  2. Get the project with your API key:
    Shell
    curl https://api.veryfront.com/projects/$PROJECT \  -H "Authorization: Bearer $VERYFRONT_API_KEY"
  3. Set ENVIRONMENT_ID to the id of the entry named production in its environments: export ENVIRONMENT_ID=<id>.
  4. Add the app's consumer key:
    Shell
    curl -X PUT https://api.veryfront.com/projects/$PROJECT/environments/$ENVIRONMENT_ID/variables/SALESFORCE_SERVICE_ACCOUNT_CLIENT_ID \  -H "Authorization: Bearer $VERYFRONT_API_KEY" \  -H "Content-Type: application/json" \  -d '{"value": "<consumer key>"}'
  5. Add its consumer secret:
    Shell
    curl -X PUT https://api.veryfront.com/projects/$PROJECT/environments/$ENVIRONMENT_ID/variables/SALESFORCE_SERVICE_ACCOUNT_CLIENT_SECRET \  -H "Authorization: Bearer $VERYFRONT_API_KEY" \  -H "Content-Type: application/json" \  -d '{"value": "<consumer secret>"}'
  6. Add your org's My Domain address:
    Shell
    curl -X PUT https://api.veryfront.com/projects/$PROJECT/environments/$ENVIRONMENT_ID/variables/SALESFORCE_SERVICE_ACCOUNT_LOGIN_URL \  -H "Authorization: Bearer $VERYFRONT_API_KEY" \  -H "Content-Type: application/json" \  -d '{"value": "https://northwind.my.salesforce.com"}'
  7. List your cases. You should now see them in content, each with its CaseNumber, Subject and Status:
    Shell
    curl -X POST https://api.veryfront.com/integration-tools/salesforce__list_cases/run \  -H "Authorization: Bearer $VERYFRONT_API_KEY" \  -H "x-veryfront-project-slug: $PROJECT" \  -H "Content-Type: application/json" \  -d '{"arguments": {}}'

Troubleshooting

If you see provider-not-connected, "Authentication required for Salesforce.", the three variables aren't on Production. Add them, then list the cases again.

Next steps