Login to leave a review
Support
How to set up (on Geotab)
These are the workflows required to implement the solution.
- In MyGeotab, navigate to People ⇒ Users & Drivers ⇒ Add
- Follow the guidelines in the Service Account documentation
How to set up (on Salesforce)
- Ensure that your Account sObject has the appropriate custom fields necessary, create if necessary
- Configure the authorization flow, follow here
- Configure Salesforce CORS Allowlist for your application, follow here
- Perform a test call using cURL or the Salesforce Postman library
How to set up Middleware
- Configure the Middleware to authenticate into MyGeotab using the service account for the appropriate database.
- OPTIONAL:
It is possible to stream data from a MyGeotab database to a relational database in your environment. Integrations might choose to do this to cache data, or to repurpose data for other needs. Using this method, the Middleware would call the relevant data from the environment instead of making a Geotab API call. See the MyGeotab API Adapter documentation for more details. - Make a GetFeed call to get the net new User entities.
You can test the JavaScript example in Geotab's SDK Runner. The example returns the first 10 results from the first Users added to the database. In reality, you would store the last returned version from the previous GetFeed and check for any new User objects since then.
let feed = (() => {
let version = "0000000000000000";
return {
next: success => {
api.call("GetFeed", {
"typeName": "User",
"resultsLimit": 10,
"fromVersion": version,
}, result => {
version = result.toVersion;
success(result.data);
});
}
};
})();
feed.next(data => {
console.log("First part: ", data);
setTimeout(() => {
feed.next(data => {
console.log("Second part: ", data);
});
}, 1000);
});
- Authenticate against your Salesforce domain, see example call below
curl https://MyDomainName.my.salesforce.com/services/data/v59.0/composite/ -H "Authorization: Bearer token -H "Content-Type: application/json" -d "@composite.json"
- Iterate over the list of User entities from the GetFeed call
- In each iteration, call the following REQUEST with the body example provided below.
Replace the USER_EMAIL with the Geotab username in the User entity, and any Geotab fields relevant to the custom fields.
{
"allOrNone" : true,
"compositeRequest": [{
"method": "POST",
"url": "/services/data/v59.0/sobjects/Account/ExternalAcctId__c/ID12345",
"referenceId": "NewAccount",
"body": {
"AccountId" : "@{NewAccount.id}"
"Name": "USER_EMAIL",
"ANY_OTHER_CUSTOM_FIELD_cc": : "CUSTOM_FIELD_VALUE"
}
},{
"method" : "POST",
"url" : "/services/data/v59.0/sobjects/Contact",
"referenceId" : "newContact",
"body" : {
"AccountId" : "@{NewAccount.id}"
"Name": "USER_EMAIL",
"ANY_OTHER_CUSTOM_FIELD_cc": : "CUSTOM_FIELD_VALUE"
}
}]
}
- Validate the RESPONSE body such that the API call was successful.
Login to leave a review
Free solution