ANS-1460 · SUITESCRIPT DEVELOPMENT

How to Resolve ‘Unexpected Error’ on Script-Created Journal Entry Approval?

Resolve 'Unexpected Error' when script-created Journal Entries fail workflow approval due to an unlocatable 'workflow (created by)' email recipient.

Short answer

To resolve the 'Unexpected Error' during script-created Journal Entry approval, modify the workflow's 'sent emails' action. For the 'to='workflow (created by)' recipient, add the condition `{custworkflow_gs_created_by}!=(internal ID)`. This prevents the system from attempting to send an email to a non-existent recipient for script-generated JEs.

Scenario

A Journal Entry (JE) workflow is configured to manage approvals. While the workflow functions correctly for JEs created directly in the NetSuite UI, an 'Unexpected Error' occurs when attempting to approve JEs created via script. This error prevents the workflow from transitioning the JE to the 'approved' state.

Solution

The issue arises because the workflow attempts to generate and send an email to the 'workflow (created by)' recipient upon approval or rejection. When a Journal Entry is created by a script, the system is unable to locate a valid email address for this recipient, leading to the generic error. To resolve this, modify the workflow's 'sent emails' action:On the 'sent emails' action where to="workflow (created by)", add the following condition:

{custworkflow_gs_created_by}!=(internal ID)

This condition ensures that the email action is only triggered when a valid 'workflow (created by)' user exists, preventing the error for script-generated Journal Entries.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant