I am wondering whether this is possible without sc...
# suitecommerce
t
I am wondering whether this is possible without scripting, When a customer places a sales order on website, a copy of the order confirmation email should go to the sales rep for that customer. I saw under website setup >order emails > emails can be static only here.
s
I don't know about this setting or other specifics, but it certainly seems like something you can do with workflows
t
I tried that doing with workflows, but it is not picking values from the sales order. The template used is system template.
It gives me like
s
Hmm. Apparently workflows can't access web-store specific things
t
Might be possible, I tried merging that system template using scripting. but that returns me "Invalid merge type". So now believing that its not possible to do so, with system templates. I am making custom email template.
s
Speaking to a colleague he doesn't think this is something NetSuite handles well. He suggests putting in conditions to check if the email is being sent by a workflow and then pulls data from different contexts/locations
t
Is it possible to know, if an email is sent by workflow or script or else ? How ?
I mean where to put conditions.
The order confirmation emails are sent by system
s
I think he was suggesting that in your standard email template that gets sent out, you edit it and then put in conditions when it goes to generate the values. You could do this on a block-by-block basis or even just have one big if/else and then duplicate the email contents in each block
h
@tuli - we're building a script for a client where we duplicate the email record sent to the customer and send it to another email address. Rather than trying to recreate the email through the code dynamically, we just copy the whole email and resend it. Not sure if this will be helpful for you.
t
Wow, I have done that using workflow and a customized template. but yes recreating all that. I am curious to know how are you doing that. @Harley
h
@tuli I wasn't the dev on the task, but my understanding is that they had a scheduled script look up any recent web store orders and collate the IDs and the emails the orders needed forwarding to. Then it would run a search for any message records that were attached to those transactions. Then it is simply a matter of duplicating the data of the message contents and updating the email to resend it to the email address you require.
t
oho, nice, but I am sticking to this for now. That will cause a delay, and if there is no webstore order, the script will keep running, which is inefficient. I might need add a flag field on the processed records and update that. Thanks anyway !