Save record to a log file. error
Hmm can't quit get this right
I have a script to cycle through contacts table to emails all contacts.
which works perfectly.
However I now want to as apart of that email process add a record into EmaiLog table for the email of that contact being emailed. (the will be other fields to record ie name/date etc but I can deal with that later.
This is the bas script
let a := (select Contacts where 'GDPR Status' = 1 and EmailSend);
for myVar in slice(a, 0, 150) do
let thisBody := first((select Contact_Mailing).xLetter1);
let myEmail := userEmail();
let xFirst := myVar.FirstName;
let myAtt := first((select Contact_Mailing).Advert6);
thisBody := replace(thisBody, "{FirstName}", xFirst);
sendEmail({
from: myEmail,
to: myVar.Email,
subject: EMailSubject,
text: EmailText,
html: thisBody,
attachments: myAtt
});
myVar.(EmailSend := 0)
end
above works perfectly !
This is the amend script for the log 3 lines but not accepting
let a := (select Contacts where 'GDPR Status' = 1 and EmailSend);
for myVar in slice(a, 0, 150) do
let thisBody := first((select Contact_Mailing).xLetter1);
let myEmail := userEmail();
let xFirst := myVar.FirstName;
let xEmail :=myVar.Email;
let myAtt := first((select Contact_Mailing).Advert6);
thisBody := replace(thisBody, "{FirstName}", xFirst);
let i := (create EmailLog);
i.(EmailLog.Email := xEmail); (this line giving an error)
sendEmail({
from: myEmail,
to: myVar.Email,
subject: EMailSubject,
text: EmailText,
html: thisBody,
attachments: myAtt
});
myVar.(EmailSend := 0)
end
EmailLog is a valid table and Email is a valid field of that table. It is not related - but even if i do create a link it still will not let me save that line? Where am I going wrong?
2 replies
-
...
let i := (create EmaiLog);
i.(Email := xEmail); -
Thanks Steven,
It is the simple things that often stump!
Clearly, I was over complicating it by adding the unnecessary table ref in front !
As ever - you are a star !
Content aside
- Status Answered
- 1 yr agoLast active
- 2Replies
- 28Views
-
2
Following