Hi Team,
I need suggestions on how to retrieve the incident status from the Salesforce API using Adobe Launch.
What would be the best approach to achieve this?
is there an alternative method that integrates well with Adobe Launch?
Let me know if you want any refinements!
Solved! Go to Solution.
Views
Replies
Total Likes
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,Status, 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);})})
This is very similar to your other post https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/need-suggestion-on-how-to... and would again require a custom code solution to call the Salesforce API to collect data into Adobe Analytics.
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 incident status.
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,Status, 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);})})
@Amruthesh_AG @Jennifer_Dungan how to fetch logged in visitor user name? Any input would be appreciate.
Views
Replies
Total Likes
@Som05 connect with site developer and check is it storing somewhere on the site if not ask them it pass it as javascript object so that you can fetch dynamically.
@Amruthesh_AG Need some help on pushing this status to data layer,
Can you please help me?
Views
Replies
Total Likes
@Amruthesh_AG window.dataLayer is the Google Data Layer, which can be used, but is most likely not being used by most Adobe implementations.
As for pushing to the data later, I would actually use the Adobe Client Data Layer extension to help with pushing anything to the data layer (assuming you are using Adobe's data layer and not your own custom solution).
But, I also am curious the end goal of pushing this information into the data layer.... if you are already calling the API yourself, and getting the information back yourself, you can just use all of that directly... why make extra steps to push it to the data layer, then create a rule to listen for the data layer change to use the information? And if you want that data to be a part of your existing server calls (and not a completely separate call which can get costly), this is going to make that even more difficult...
@Som05 We are curious to know what are you going to do with incident status?
As @Jennifer_Dungan mentioned why do you want it need to pass to data layer?
@Jennifer_DunganYea when l implementing anything I was setting it as ACDL
Also, as for the User Name, first off, I would be leery about collecting the "User Name" as this is PII... but if you really need it, depending on your site, you might need your developers to provide the information into your Data Layer (or a custom window scoped object) so that you can read it into your tracking.. or you might even be able to extract it from the user's cookies or session storage? (Some login systems hold use information in the storage to use on the site "welcome back x", or the user's name showing in the header that links to their profile, etc - this saves calls to the DB on each use), if the information is available, you can just read it directly and use it.
Views
Likes
Replies
Views
Likes
Replies