A node-based server that can push JSON-defined objects to Salesforce, using oauth2 for authentication
- Install Node JS
- Place this folder somewhere convenient
- Navigate to this folder in the terminal
- Run
npm install. This will install all the required packages for the application - Client key, client secret and callback URL are stored in the file
.env. Copy the supplied.example.envfile as.envand enter your own Salesforce details.
Salesforce requires the page to run under HTTPS. I used as self-certified SSL certificate to generate my key.pem and cert.pem files. This link was helpful in generating them using OpenSSL in linux. You may be able to just use mine. Your browser will complain either way - they don't like self-signed SSL.
- Add your template file to /mappings (see below)
- Navigate to this folder in the terminal
- Run
npm run start. You will see a message in the terminal telling you the server is running - Navigate to "https://localhost:3000" in your browser. The HTTPS, rather than HTTP, is important
- Click the login button and you will be asked to authenticate to Salesforce
- Once authenticated, you will land on the list page. It will show the mappings that are already uploaded in the account, and a list of files found in /mappings
- Click upload on your mapping file.
- The file will be uploaded and you will be redirected to a results page. Blocking errors will be shown at the top. Non-blocking errors will be shown in the body of the results JSON
The files you place in /mappings must be JSON files, following this format:
[
{
"objectType": "Mapping_Rule__c",
"data": {
"ObjectField1": "ObjectFieldValue",
"another": "field"
},
"children": [
{
"a nested": "object"
}
]
}
]objectType and data are mandatory
When assigning children to parent objects, we assume that the parent "objectType" is the name of the field in the child.
e.g. the above example will include "Mapping_Rule__c": "returnedIdForParentMappingRule" when we save the child