0

Script Editor will not accept known field

It is probably me! but after much head scratching I need a bit of help - PLEASE!

I have the below script which has been working perfectly fine for a couple of years. But I now want to add in an extra Logo image to go next to our logo - so have added 3 extra lines (shown in blue). However the editor will not play ball. in that it refuses to accept the new image field (xLogo2). (I get line 9 field HTMLxLogo not found, even tho xLogo2 is in the pick list)

I have tried renaming the field. Changing the location of the field to be same as Logo1 etc

if I remove the HTML prefix it accepts the field but then on the next line gives me "a function not defined error (line 10)"

both logo 1 and logo 2 need the HTML other i can't use the raw element further down (line 19)

I have even played with {UL1} to be different ie 2 ,3 etc ....

At the moment I cannot see the wood for the trees. so any suggestion/help would be greatfully received

 

let xEMSubject := Mailer;
let a := (select Contacts where GDPR_Status = 1 and EmailSend);
for myVar in slice(a, 0, 150) do
    let thisBody := first((select Contact_Mailing).xLetter2);
    let xEmail := myVar.Email;
    let myEmail := userEmail();
    let log1 := first(select Quote_Settings).HTMLxLogo;
    let log1 := replace(log1, "{UL1}", shareFile(first(select Quote_Settings).xLogo));
    let log2 := first(select Contact_Mailing).HTMLxLogo2;
    let log2 := replace(log2, "{UL1}", shareFile(first(select Contact_Mailing).xLogo2));

    let xFirstName := myVar.FirstName;
    let xFullName := myVar.FullName;
    let xMailDate := myVar.today();
    let xOptInDate := myVar.OptInDate;
    let xOptOutDate := myVar.OptOutDate;
    let myAtt := first((select Contact_Mailing).Advert4);
    thisBody := replace(thisBody, "{FirstName}", xFirstName);

    thisBody := replace(raw(thisBody), "{xLogo}", log1);
    thisBody := replace(raw(thisBody), "{xLogo2}", log2);

    let i := (create EmailSentLog);
    i.(Email := xEmail);
    i.(FullName := xFullName);
    i.(MailerDate := xMailDate);
    i.(OptInDate := xOptInDate);
    i.(OptOutDate := xOptOutDate);
    i.(Mailer := xEMSubject);
    sendEmail({
        from: myEmail,
        to: myVar.Email,
        subject: Mailer,
        text: "text",
        html: thisBody,
        attachments: myAtt
    });
    myVar.(EmailSend := 0)
end

2 replies

null
    • Mel_Charles
    • 4 mths ago
    • Reported - view

    I AM STUPID !

    I forgot to add an additional field for the HTML spec! for th second logo !

    Ignore me ! 🤣

    • Ninox partner
    • RoSoft_Steven.1
    • 4 mths ago
    • Reported - view

    You got this  😉

Content aside

  • Status Answered
  • 4 mths agoLast active
  • 2Replies
  • 42Views
  • 2 Following