Developer forum

Forum » Development » Orderflow and emails

Orderflow and emails

Jan Sangill
Reply

Hi,
I am in a a situation where I need to sometimes send out an email when order is complete and manipulate the email itself.
I have read I can do this is: SendingConfirmationMail

So far so good.

However, somestimes I need this email not to send out. I guess that can be done in this method too? Or in earlier process by setting a different status somehow?

The emails not sent out I need hold on too - and at X time bulk send these. For this I will need to create a scheduled task.

I will in this task loop over the orders and manually send them out or tell the system its ok to send out know.
- How would this part be achieved?
- Any suggestions for me?
- Would I need to myself recreate the order somehow?
- WIll the system itself take care of this when saved to a correct status via API?

I know theres a lot of questions. Any advice appreciated!
 


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi Jan,

I'm not quite sure what is the nature of your mail content. If it's straight data (and not any page that needs rendering), it sounds like you need to put your mail content to a custom table (of title, body etc), and have a time column indicating when it should be sent. You can use the ordinary Scheduled Tasks to trigger a piece of code that will run through your table and send what needs to be send.

 

BR
Morten

 
Jan Sangill
Reply

Hi Morten,

TY for your input. As I read your reply, I think I know how I want to keep track of my orders not sent.

Question 1:

I would prefer it was a template that was rendered - would make it easier to keep an eye on. In regards to the email.

The mail that needs to be sent is the order email - or something simular.

How is that done within a scheduled task? Cant quire find that part in the API and how to do this.

Question 2:

I am also thinking of another approach in the scheduled task, to simply change the orderstate. But I then need to be able to dynamiccaly hook up on the email sent out via  a subscriber.
Can I access a subscriber for OrderFlows and when the state is changed manipulate the email it is sending too and more?
 

 
Jan Sangill
Reply

I found out how I wanted to achive this, so closing this:


Question 1: I did some checking, and found the code:

 Template template = new Template  and so on.

Question 2:

Doing all of this is the scheduled task. Changing the orderstate, sending email myself, and so on
 

 

You must be logged in to post in the forum