I have this code that goes in the VTEX Master Data (bank) and makes an inquiry in a certain email. If you have this email, you have to bring the customer's phone number.
How do I save the result of the object in a variable? It only appears on the console. The way I did it does not appear in the code.
function ContactCreateByEmail(storeName, dataEntity, CriteoEmail) {
var cl_url = "https://api.vtexcrm.com.br/|||||||||||||||||/dataentities/|||||||||||||||||/search?_fields=homePhone&_where=email={{CriteoEmail}}";
$.ajax({
headers: {
"Accept": "application/vnd.vtex.ds.v10+json",
"Content-Type": "application/json"
},
type: 'GET',
url: cl_url,
success: function(data) {
var retorno_ajax = data[0]; //or something similar
if (retorno_ajax == null) {
console.log('nenhum dado retornado');
}
else {
console.log('retorno_ajax');
}
},
});
__blc['id'] = "61ab36efda06b8c498209f4d0c725948";
try {
lc.sendData({
evento: "sms_transacional",
transactionId: "{{transactionId}}",
customer_id: "{{CriteoEmail}}",
numero: (retorno_ajax),
});
} catch (e) { }
}
ContactCreateByEmail('duloren', 'CL', '{{CriteoEmail}}') <