Hi Team,
We are storing user order history in Salesforce, we are required to fetch the logged-in user order total.
Please let me know is any way or extension available to pull the data from Salesforce.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
HI @Som05
After reviewing the post https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/how-to-integrate-salesfor... I got some insights to write some custom code as below.
Add this code through adobe launch as a custom code.
const authTokenUrl = "{{end point url}}/services/oauth2/token?grant_type=password&client_id={{Pass the client id here}}.&client_secret={{Pass the client secret here}}&username={{Pass the API username here}}&password={{Pass the API username password}}";
const apiUrl = "{{sandbox url}}/services/data/v50.0/query?q=SELECT Id,Lead_Email,OrderID, Description FROM Case WHERE Lead_Email='{{Pass the logged in user name here}}'";
// Step 1: Get the Auth Token (GET request)
fetch(`${authTokenUrl}`, {
method: "POST",
})
.then(response => {
return response.json()
}).then(authResp => {
let access_token = authResp.access_token;
fetch(apiUrl,{
method: "GET",
headers: {
"Authorization" : "Bearer "+access_token }
}).then(response1 => {
return response1.json()
}).then(result => {
console.log(result);})})
Note: Id,Lead_Email,OrderID, these fileds I have randomly defined, you need to check with Salesforce team to map the proper field ID.
Hi @Som05 Adobe Analytics don't have any extension or native integration to fetch the data from Salesforce.
You have to write a custom script to fetch the order total using API.
It would be beneficial to go through this post: https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/how-to-integrate-salesfor...
If you want to pull Salesforce data into Adobe Analytics, this is not possible OOTB, you would have to custom code the integration. You will likely need to generate a purchase ID from your e-commerce platform that feeds into both Analytics and Salesforce, to link the AA visitor ID with the SF customer ID.
Does your company's Salesforce instance have a D2C (direct-to-consumer) data model?
- If the answer is yes, then you will have parity with Adobe Analytics data, which has event data at the ECID level for individuals.
- If your company does B2B, then Salesforce will have data at the account level, where one account contains multiple individuals that can generate orders. Tying B2B data from Salesforce to Adobe Analytics will be more complex, but can be achieved outside of Analytics and Salesforce.
HI @Som05
After reviewing the post https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/how-to-integrate-salesfor... I got some insights to write some custom code as below.
Add this code through adobe launch as a custom code.
const authTokenUrl = "{{end point url}}/services/oauth2/token?grant_type=password&client_id={{Pass the client id here}}.&client_secret={{Pass the client secret here}}&username={{Pass the API username here}}&password={{Pass the API username password}}";
const apiUrl = "{{sandbox url}}/services/data/v50.0/query?q=SELECT Id,Lead_Email,OrderID, Description FROM Case WHERE Lead_Email='{{Pass the logged in user name here}}'";
// Step 1: Get the Auth Token (GET request)
fetch(`${authTokenUrl}`, {
method: "POST",
})
.then(response => {
return response.json()
}).then(authResp => {
let access_token = authResp.access_token;
fetch(apiUrl,{
method: "GET",
headers: {
"Authorization" : "Bearer "+access_token }
}).then(response1 => {
return response1.json()
}).then(result => {
console.log(result);})})
Note: Id,Lead_Email,OrderID, these fileds I have randomly defined, you need to check with Salesforce team to map the proper field ID.
@Amruthesh_AG @Arturojrivero When I add this custom code. Why I am getting blocked by CORS policy error?
@Amruthesh_AG Many thanks for your valuable support🥰
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies