0
Cant receive emails
Hey I'm new at this so my script was made on chatgpt, at the beginning it worked but then is not working anymore. I want to receive an email with specific records after the import of my cvs, so this is what i did
let registrosImportados := this;
log(count(registrosImportados));
if count(registrosImportados) > 0 then
let contenido := "<h2>Registros Importados Recientemente con foco rojo</h2>";
contenido := contenido + "<table border='1' style='border-collapse:collapse; text-align:left;'>";
contenido := contenido + "<tr>" + "<th>DiaFecha</th>" + "<th>Sku</th>" + "<th>Tienda</th>" +
"<th>Depto</th>" +
"<th>Comprador</th>" +
"<th>Capa</th>" +
"<th>InvFinUni</th>" +
"<th>InvFinCto</th>" +
"<th>InvFinVta</th>" +
"<th>MargenObtenidoInv</th>" +
"<th>DiasdeInventario</th>" +
"<th>VentaNetaaCosto</th>" +
"<th>VentaNetaenPesos</th>" +
"<th>VentaNetaenUnidades</th>" +
"<th>RebajaVta</th>" +
"<th>MargenObtenidoVenta</th>" +
"<th>DiferenciaMargen</th>" +
"<th>DifPesos</th>" +
"</tr>";
alert("Registros importados encontrados: " + count(registrosImportados));
for r in registrosImportados do
if r.InvFinCto > r.InvFinVta or r.VentaNetaaCosto > r.VentaNetaenPesos then
contenido := contenido + "<tr>" + "<td>" + r.DiaFecha + "</td>" + "<td>" + r.Sku + "</td>" +
"<td>" +
r.Tienda +
"</td>" +
"<td>" +
r.Depto +
"</td>" +
"<td>" +
r.Comprador +
"</td>" +
"<td>" +
r.Capa +
"</td>" +
"<td>" +
r.InvFinUni +
"</td>" +
"<td>" +
r.InvFinCto +
"</td>" +
"<td>" +
r.InvFinVta +
"</td>" +
"<td>" +
r.MargenObtenidoInv +
"</td>" +
"<td>" +
r.DiasdeInventario +
"</td>" +
"<td>" +
r.VentaNetaaCosto +
"</td>" +
"<td>" +
r.VentaNetaenPesos +
"</td>" +
"<td>" +
r.VentaNetaenUnidades +
"</td>" +
"<td>" +
r.RebajaVta +
"</td>" +
"<td>" +
r.MargenObtenidoVenta +
"</td>" +
"<td>" +
r.DiferenciaMargen +
"</td>" +
"<td>" +
r.DifPesos +
"</td>" +
"</tr>"
end
end;
contenido := contenido + "</table>";
alert("Se enviará un correo con la información");
sendEmail({
from: userEmail(),
to: "fernando@yeetel.com.mx",
cc: userEmail(),
bcc: "fernando@yeetel.com.mx",
subject: "Reporte de focos rojos",
text: "Este correo es un sistema automatizado, la información aquí presentada se obtiene directamente de la base de datos del cliente",
html: contenido
})
else
alert("No hay registros en riesgo.")
end
Hope i can get your help.
Reply
Content aside
- 7 days agoLast active
- 12Views
-
1
Following