I’m piloting a system that sends multiple emails. Users are constantly wanting to make adjustments to the wording of emails and so I’d decided that rather than having to keep editing the template, I’d create a form (fEmail) and related view (fView) which administrators could use to edit email content.
The form contains text fields corresponding to each of the parameters of the @mailsend function plus a field (Email_Context) which contains a value to uniquely identify the record. Fields are populated with code exactly as if directly entered into the @mailsend function (e.g. the Email_Subject field contains: "Submitted Order No. " +FieldOrderNumber)
This is the code in my email button, which I was hoping to use in all my email buttons, and simply changing the value for the context:
context:=“form1.email1”;
EmailCopyTo:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_CopyTo”);
EmailBlindCopyTo:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_BlindCopyTo”);
EmailSubject:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_Subject”);
EmailRemark:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_Remark”);
EmailFields:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_Fields”);
EmailFlags:= @DbLookup(“”:“NoCache”;“”:“”;“vEmail”;context;“fEmail_Flags”);
@MailSend(@UserName;EmailCopyTo;EmailBlindCopyTo;EmailSubject;EmailRemark;EmailFields;EmailFlags);
However, when sending emails I get “not found” error messages for the cc and bcc fields.
Another even bigger problem is that the resulting email Subject and Body contain the code returned from the @dblookup fields rather than the result of its evaluation, e.g. the Subject in the email contains:
"Submitted Order No. " +FieldOrderNumber
rather than:
Submitted Order No. 1234
I’ve tried all sorts of things with @text but can’t solve the problem - any ideas what I’m doing wrong?