Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This article is out of date. We will update this soon.

You now have to create an Auth. Provider of type Open ID

Create a Named Credential

And specify the name of that named credential on your administration

Create OAuth Token

To set up the Salesforce to Exact Online integration, we require an OAuth Token to be present. The OAuth Token can be created by running the following piece of code in the Anonymously in the Developer Console.

The id that is logged on line 8 will be important for the next step, make sure you write it down. In the rest of the document, we reference this id by using <ID>.

We will set up a connection to https://start.exactonline.nl, depending on your country this URL can change (for example for Germany we use https://start.exactonline.de).

Subscription25__OAuth_Token__c oAuthToken = new Subscription25__OAuth_Token__c();
oAuthToken.Name = 'Exact Online';
oAuthToken.Subscription25__Client_Id__c = '-';
oAuthToken.Subscription25__Client_Secret__c = '-';
oAuthToken.Subscription25__Endpoint__c = 'https://start.exactonline.nl';

Database.insert(oAuthToken);
system.debug(oAuthToken.Id);

Navigate to the following URL, replacing <ID> with the Id of the record you just created, http://login.salesforce.com/apex/Subscription25__OAuth?tokenId=<ID>

You are now redirected to a new page, copy the URL of that page.

The URL should look something similar to https://<YOURDOMAIN>.visualforce.com/apex/OAuth?tokenId=<ID>


Create Exact App Centre OAuth App

Log into Exact App centre on https://apps.exactonline.com/, press manage my apps in the top right corner.

Press register an app, give it the name “Salesforce”, for the redirect URI use the URL we just copied. Accept the terms and press Register.

You will see the page, from this page we will need to copy the Client ID and the Client Secret.


Update OAuth Token

Navigating back to the developer console of Salesforce, run the following piece of code. Replace <ID> with the id of the token from Salesforce, replace <CLIENT_ID> with the Client ID copied from the Exact Authorisation Details above, replace <CLIENT_SECRET> with the Client Secret copied from the Exact Authorisation details.

Subscription25__OAuth_Token__c OAuthToken2 = [
  SELECT Subscription25__Client_Id__c, Subscription25__Client_Secret__c 
  FROM Subscription25__OAuth_Token__c 
  WHERE Id = '<ID>'
];

oAuthToken2.Subscription25__Client_Id__c = '<CLIENT_ID>';
oAuthToken2.Subscription25__Client_Secret__c = '<CLIENT_SECRET>';
Database.update(OAuthToken2);

Create a remote site setting

Salesforce will communicate from Salesforce to Exact Online by using an URL which should be whitelisted in your remote site settings of Salesforce, in this example we use https://start.exactonline.nl. Which might change based on your Exact instance.

Salesforce explains how to create a remote site setting on this page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_remote_site_settings.htm

  1. From Setup, enter Remote Site Settings in the Quick Find box, then select Remote Site Settings.

  2. Click New Remote Site.

  3. Enter a descriptive term for the Remote Site Name.

  4. Enter the URL for the remote site.

  5. Optionally, enter a description of the site.

  6. Click Save.

A remote site setting would look something like this:


Activate the token

Navigate back to the URL you used before to grab the URL: http://login.salesforce.com/apex/Subscription25__OAuth?tokenId=<ID>

Press the Authorize button. You are navigated to Exact Online and might to log in again. After you’ve done this you need to accept the terms:

After you’ve done this you are redirected to Salesforce and will need to press the Get Refresh Token button. You will get a success notification after you’ve done this.

Congratulations, your connection between Salesforce and Exact Online is now successfully set up!

  • No labels