0

Action after clicking on "send email".

Hello everyone.

I have an email field for weekly reports I need to send out.

When I click on the "letter" symbol of that email field, which will open an email in my Outlook, I would like that this click also prints date and time into another field as a reference. But I have only an option to trigger something after an update to the field. Not when clicking on the "letter" symbol.

How can I get this done?

 

Thanks for any help.

4 replies

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    You might want to consider not directly using the mail client email file directly and using a script the trigger "sendmail"

    it is harder to implement but gives good flexibvility

    ie I send an order dispatch notification out from a job card (I do this from a script on a button) and it picks up the email from a text field on the jobbag rather than the email field. AND in doing so

    you can have the date/times withing the email letter sent out and also add the code to the end to trigger updating date/times fields on your . I just record the date (see line in bold)

    Screenshot 2022-01-27 at 17.31.45

    I've change a few details to protect my client info

    here is the script on the button! see below

    It check to see if the job status is still in production. It then checks to see if the email field is blank! then checks if it has already been dispatched so wont send again. Otherwise send the email by picking up the letter template (OrderDispatchedLetter) I hold this letter in another table and merely reference it and finally add an advert attachment!.

    As you can see it handles dates (so will handle times too)

    if Status < 2 or Status > 3 then
    alert("job Status is not in production")
    else
    Status := 3;
    if not 'Email+' then
    alert("No valid contact in email field")
    else
    if DispFlag = 1 then
    alert("Dispatched Confirmation already sent!")
    else
    let thisBody := first((select SystemFile).OrderDispatchedLetter);
    let myEmail := userEmail();
    let myAtt := first(files(record(SystemFile,1)));
    thisBody := replace(thisBody, "{Ord Company}", text('Ord Company'));
    thisBody := replace(thisBody, "{Order Name}", text('Order Name'));
    thisBody := replace(thisBody, "{Job Bag}", text('Job Bag'));
    thisBody := replace(thisBody, "{Order Date}", text('Order Date'));
    thisBody := replace(thisBody, "{Order Name}", 'Order Name');
    thisBody := replace(thisBody, "{Order Ref}", 'Order Ref');
    thisBody := replace(thisBody, "{Qty}", text(Qty));
    thisBody := replace(thisBody, "{Desc}", Desc);
    thisBody := replace(thisBody, "{Del Company}", text('Del Company'));
    thisBody := replace(thisBody, "{Del Address}", text('Del Address'));
    DispFlag := 1;
    sendEmail({
    from: myEmail,
    to: 'Email+',
    subject: "Your order has been dispatched by 118 Printgroup",
    text: "Goods Dispatched Confirmation",
    html: thisBody,
    attachments: myAtt
    });
    alert("Goods Dispatched Email has been Sent");

    Sentdate := (today();

    DisplayMenu := 1
    end
    end
    end

     

    The letter format (screen dump)

    Screenshot 2022-01-27 at 17.45.31

     

    Letter format (incase you want to copy an edit)

    <H2> Your Order has been Dispatched from 118 Printgroup:</H2>
    <hr>
    <p><b>{Ord Company} - {Order Name}</b>
    <br>
    <p>Thank you for placing your order with 118 Print.
    <p>Your order has been dispatched and will be with you soon. Depending upon the parcel(s) size and your location, our carriers aim to deliver to you within <b> 24/48hrs </b> for mainland UK deliveries.
    <p>
    <i>Job details are as follows:-</i>
    <p>Product Ordered: <b>{Qty} {Desc} </b>
    <p>Order Date: <b>{Order Date}</b> -- Your Ref: <b>{Order Name} {Order Ref} </b>
    <p>Delivery Address: <b>{Del Company} {Del Address} </b>
    <p>Our Job Ref: <b>{Job Bag}</b>
    <p>We will keep you updated regarding any emerging situation that may affect your delivery.
    <p>We value your business and are constantly looking for ways to better satisfy our customers. So please do share with us if there is a way that you think we can serve your better.
    <h3>Ask us about our small print runs on Mugs - Pens - Notebooks (A6 & A5 Plain and Ruled) - Cotton Bags.
    </h3> <p><Small> all available on a selected range of our quick turnaround products!.<br>
    <p><H3>118 Printgroup Customer Services</h3>
    <p>Sales: 0330 202 0552
    <p>sales@118printgroup.co.uk <br>
    <p><small> We cannot accept any responsibility for any delays once goods have left our works and are in the hands of the carriers - Especially during the covid19 crisis.

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Another way might be to try and fool the email field that it has been changed in some way (ie updated)

    ie have a trigger else where to copy the content of the email field to. a variable. Then flush the email field to null then reupdate it from the stored variable.

    The script could not be run in the email field itself so probably would need to be in another field that you know you will always update so it triggers it's script after modifying

    Bit Busy at the moment but try and take a look later to see if it is doable

    • NetSol Co., Ltd.
    • Bernd_Krell
    • 2 yrs ago
    • Reported - view

    Hello Mel. That's a great idea. I do like the idea with the button much more and will try this.

    Thanks a lot for taking the time to reply.

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Hi Bernd

    Okay - Hope you get on okay.

    There is a lot you can do with script/send email very flexible.

    I'm having it send confirmation orders/dispatch notes. even follow up mails when a customer places just one order etc...

    Just remember you can have the Letter templates on the same form... but I found it better to have them all in another table and reference them.!

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 214Views