Why your NetSuite workflow email never sends on web store orders

On this page

Two defaults stop it. A new workflow starts in Testing, and a workflow in Testing only starts for its owner, never for the shopper who places a web store order. The Send Email action also has its own Contexts list, which in my build started without Web Store. Release the workflow and add Web Store to the action’s contexts, and the email goes out.

I built one of these for a client whose customer service team wanted an email for every web order. The first test order produced nothing. The second ran the workflow and still sent nothing. Neither showed an error anywhere. Both causes are defaults, so they’ll catch anyone building this for the first time.

The workflow that works

One workflow on sales orders, one state, one Send Email action. Go to Customization > Workflow > Workflows > New.

FieldValue
Record TypeTransaction
Sub TypesSales Order
Execute As AdminChecked
Release StatusReleased
Keep Instance and HistoryAlways
Enable LoggingChecked
InitiationEvent Based, On Create
Trigger TypeAfter Record Submit
Event TypesCreate
ContextsWeb Store only

Saving it opens the diagram with one state. Leave that state with no transitions and Do Not Exit Workflow unchecked. Oracle’s workflow states page says “any state with no outgoing transitions is an end state”, and on an exit state NetSuite runs the actions “and then completes the workflow”. That’s what mine did: it sent the email and finished, and no instance stayed open on the order.

In the state, click New Action and choose Send Email:

FieldValue
Trigger OnEntry
ContextsKeep the default selection, then add Web Store and Web Application
SenderSpecific Sender, an employee record for your no-reply address
RecipientSpecific Recipient, an employee record holding the team inbox, or a Free Form Address
ContentUse Template

The subject line on my template is plain FreeMarker over the transaction:

TEXT
New web order ${transaction.tranid} - ${transaction.entity}

tranid is the order number and entity is the customer as NetSuite displays it, which on my account was the customer ID followed by the name. I created the template from a File Cabinet file (Create Template From: File) rather than typing it into the template editor.

A recipient that’s an employee record keeps the address on one record instead of inside the workflow. Oracle’s Send Email action page also offers Free Form Address, “Email address or addresses to use”, if you’d rather not. The same page notes that email templates need the Mail Merge feature enabled.

Default one: a new workflow is in Testing

Oracle’s release status page is plain about it. In Testing, “a workflow instance initiates only for the workflow owner”, and Testing “is the default Release Status when you create a new workflow.”

A web store order is created by the shopper, not by you. So a workflow in Testing never starts on one. There’s no instance on the order and no log, because nothing ran. That was my first test order.

Released is what you want: “an instance of the workflow initiates for any user with access to its base record type.” Two more settings change meaning when you switch. Creating a workflow says Enable Logging is checked by default in testing mode, “but in released mode, you must check the box yourself.” Keep Instance and History defaults to Only When Testing. Set it to Always, or a released workflow leaves no history to check.

Default two: the action’s contexts leave out the web store

Contexts filter a workflow by how the record was touched: the UI, a CSV import, web services, the web store. Oracle says you set them in three places, “using the Contexts field on the workflow, action, or transition definition pages.”

Oracle’s execution contexts page gives the default for workflows and script deployments: “By default, all contexts are selected except for Web Application and Web Store”, and it tells you to select those two explicitly if you want them.

Setting Web Store on the workflow isn’t enough, because the action has its own list. Oracle doesn’t state that list’s default. On the account I built this on, a new Send Email action started with Web Store and Web Application both unselected. So the workflow started on a web order, entered the state, and the action didn’t run. That was my second test order. The workflow ran, and no email went out.

Open the action, keep the selection it has, and Ctrl-click (Cmd-click on a Mac) Web Store to add it. I added Web Application too. Oracle’s execution context types describe it as “a web application task in Commerce”, next to Web Store’s “a web store task in Commerce”, and the workflow’s own Contexts still limit it to web store orders.

The same default applies to scripts. The page says “the same values and defaults apply to both”, and the Context Filtering subtab on a script deployment starts the same way. So a user event script deployed on sales orders skips web store orders too, unless its deployment selects Web Store.

Execute As Admin doesn’t change who it starts for

Execute As Admin runs the workflow instance “as a user with the Administrator role”, and “these privileges override the role of the user who initiated the workflow instance.” Oracle’s own example is a workflow that reads employee records, which “won’t work if the user doesn’t have access to those records.”

That’s this workflow. The sender and recipient are employee records, and a shopper’s role has no business reading them. I checked the box for that reason. Oracle also says to use it “only when required”, and this is a case where it is. Only a user with the Administrator role can check it. Roles fence a workflow the same way they fence a query, which I go into in why SuiteQL says “Record ‘transaction’ was not found”.

What it doesn’t do is make the workflow start. Release Status decides whose actions start an instance. Execute As Admin only changes the permissions an instance runs with once it has started.

Testing it on a sandbox

Check the sandbox can send email at all before you place an order. Its Sandbox Options can be set to Do Not Send Emails, and that looks exactly like a workflow that never fires. The setting and a refresh’s effect on it are in what to redo after a NetSuite sandbox refresh. Choose Send Email To with your own address while you test. And if the sandbox store is reachable from the internet, keep it out of Google before you start placing orders on it.

Then place an order through the store and read what happened.

  1. Open the order’s execution log. Oracle puts it on the record: “click the System Information subtab… click the Workflow History subtab, then click Log for the state you want to view.” See the workflow execution log page.
  2. No instance at all means the workflow never started. Check Release Status, then the workflow’s Contexts and Event Types.
  3. An instance with no Executed Send Email means it started and the action didn’t run. Oracle lists four statuses for an action: Executed, Failed, Skipped and Considered. An action filtered out by its own Contexts may not appear in the log at all, unless you check Show Rejected Actions/Transitions. Check the action’s Contexts first. Then check the trigger: Oracle notes that Send Email “will be skipped if the record enters the state on a Before Record Load or Before Record Submit trigger”, which is why the workflow above triggers After Record Submit.
  4. Failed usually names the cause. A permission error points at Execute As Admin. A template error names the line.

Then key an order by hand in the NetSuite UI. No instance should appear on it, which proves the Web Store filter is doing its job.

To check the template without placing more orders, open any web order, go to the Communication subtab, then Messages, and click Email. Pick your template and click Preview. In my build, with the template created from a file, the template editor showed it with the FreeMarker directives stripped out, while Preview merged it against the order. Preview is the one to trust.

Going live

A sandbox can’t prove the email reaches the real inbox. Build the template and workflow again in production, with logging on, and let the first real web order be the test. Check its Workflow History, and ask the team whether the email arrived. Once a week’s history is clean, turn logging off.

If you need to stop it, set Release Status to Not Initiating. Oracle says new instances don’t start “but instances already running continue to run.” Orders aren’t affected either way, since the workflow only sends mail.

This post is part of the NetSuite Admin cluster. The tools I use are on the resources page.

Frequently Asked Questions

Why does my workflow run when I test it but not for customers?

It's still in Testing. A workflow in Testing initiates only for its owner. Set Release Status to Released, and check that Enable Logging is ticked, because in released mode Oracle says you have to tick it yourself.

Does Execute As Admin make the workflow run for everyone?

No. It changes the permissions an instance runs with after it starts. Who it starts for is set by Release Status.

Which context is a web store order?

Web Store, which Oracle's execution context types describe as "a web store task in Commerce". An order keyed in NetSuite is User Interface, "an event in the NetSuite UI", and a CSV import is CSV Import, so a workflow limited to Web Store ignores both.

Do user event scripts have the same problem?

Yes. Oracle says execution context filtering works the same way for scripts and workflows, with the same defaults, and a script deployment's Context Filtering subtab starts without Web Store. A deployment that should run on web store orders has to select it explicitly.

Will a sandbox web store order email the real customer?

It depends on the sandbox's email settings, which a refresh copies from production. What to redo after a NetSuite sandbox refresh covers the options and which one keeps test email away from customers.

Working on a NetSuite project? Get in touch.