This project was bootstrapped with Create React App.
This project demonstrates Salesforce data interaction using Node.js and jsforce. This is a POC designed to understand how A React App using Node can fetch data from a Salesforce org levaraging jsforce lib that communicates through APIs to Salesforce
Ensure you have the following libraries installed:
- jsforce
- dotenv
Run the following command to install the required dependencies:
npm install jsforce dotenv
git clone https://github.com/tomsouza4/query-data-from-salesforce-using-jsforce.git
Navigate to the project directory:
cd query-data-from-salesforce-using-jsforce
Install dependencies:
npm install
Run the React app:
npm start
Execute the script:
node src/CreateFields.js
Access Token Example:
00D8b0000022ug0!AQ8AQDTB8oa2CJdKDtx7t68ZbGid27hrU9BhTyG7WLbZBila46v5F7Gzap9pWCxVF8VDfUk.jD7h7t9q6mbYP._bjjDSQc22
Instance URL: https://wise-goat-rgjb32-dev-ed.trailblaze.my.salesforce.com
User ID: 0058b00000HEcA4AAL Org ID: 00D8b0000022ug0EAA
Total records: 22 Fetched records: 22
Fetched 22 records:
- My Account #1 (0018b00002XvzaDAAR)
- My Account #2 (0018b00002XvzaEAAR)
- My Account #1 (0018b00002XvzaIAAR)
- My Account #2 (0018b00002XvzaJAAR) ...
- Postman (0018b00002NN8lBAAT)
- Captain Bly’s Finest Treasure Chests (0018b00002NNJ56AAH)
If your Salesforce password and token include a single quote, make sure to escape it with a backslash () to prevent issues with code interpretation.
Be cautious with special characters like single quotes in your Salesforce password or token, as they might affect code interpretation.
- Create the connected app
![image](https://private-user-images.githubusercontent.com/11336182/296393711-bfa6f3cd-3873-4e1b-a1df-ec38de23a20b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA5OTU4MjIsIm5iZiI6MTcyMDk5NTUyMiwicGF0aCI6Ii8xMTMzNjE4Mi8yOTYzOTM3MTEtYmZhNmYzY2QtMzg3My00ZTFiLWExZGYtZWMzOGRlMjNhMjBiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE0VDIyMTg0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA1NjFlY2ZhZDczOTI1M2YzYjVjNzAwOGQyMmQ3NGI1NDBjM2Y4NjU0MTE2YzQwODRhZTBhMzY1MWZmZjk3MzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u0Hoy_8OGYAr6Nu5SsPRkKDFTDqcIh_3ZfXrZjGrW0k)
- Set the Permitted Users & IP Relaxation
![image](https://private-user-images.githubusercontent.com/11336182/296393799-52232489-fadb-4f8f-8daa-b3f91aeb206a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA5OTU4MjIsIm5iZiI6MTcyMDk5NTUyMiwicGF0aCI6Ii8xMTMzNjE4Mi8yOTYzOTM3OTktNTIyMzI0ODktZmFkYi00ZjhmLThkYWEtYjNmOTFhZWIyMDZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE0VDIyMTg0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwOGNiNGY3ZmVkN2Q3ODFjMDcyODY0NDVkMjBjNjVjMWMzY2FjZWQ5NTllN2VjMzY2NjBmOWJhNWFmNzUzZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5azWLK6tfjVmXaoGvxNK2Wp1FnRTGHz2MKHtw0jDl3Q)