Lightweight package which aims decrease the development time of new integrations.
- Install npm
- Install Salesforce DX CLI
- Alternative:
npm install sfdx-cli --global
- Alternative:
- Clone this repository (GitHub Desktop is recommended for non-developers)
- Run
npm install
from the project root folder - Install SSDX
- Non-developers may stop after this step
- Install VS Code (recommended)
- Install Salesforce Extension Pack
- Install recommended plugins! A notification should appear when opening VS Code. It will prompt you to install recommended plugins.
- Install AdoptOpenJDK (only version 8 or 11)
- Open VS Code settings and search for
salesforcedx-vscode-apex
- Under
Java Home
, add the following:- macOS:
/Library/Java/JavaVirtualMachines/adoptopenjdk-[VERSION_NUMBER].jdk/Contents/Home
- Windows:
C:\\Program Files\\AdoptOpenJDK\\jdk-[VERSION_NUMBER]-hotspot
- macOS:
To build the project locally follow these steps:
- If you have not authenticated to a DevHub run
sfdx auth:web:login -d -a production
and the log in. - Create scratch org and push project source.
npm install
npm run mac:build
The integration can be configured by creating new records on the following Custom Metadata Objects:
IntegrationConfiguration__mdt
IntegrationService__mdt
Below is a simple example of how to use the CalloutController. Provide the API names of the Custom Metadata records when initializing the request.
CalloutController callout = new CalloutController();
callout.initRequest('TEST_CONFIG', 'TEST_SERVICE');
callout.sendRequest();
Salesforce does not allow HTTP Callouts in a Test Context. Therefor we need to use Mocks.
In your IntegrationService__mdt
it is possible provide a mock response that can be used in a test class.
{
"200": {
"body": <Add your expected response here>,
"headers": null
},
"500": {
"body": "Internal Server Error",
"headers": null
}
}
CalloutMock mock = new CalloutMock();
mock.setMock(200, 'OK', 'TEST_SERVICE');
CalloutController callout = new CalloutController();
Test.startTest();
callout.initRequest('TEST_CONFIG', 'TEST_SERVICE');
callout.sendRequest();
Test.stopTest();
- This tool currently only supports REST.