Creating a Workflow

When you create a workflow, you specify its basic workflow properties, event initiation, and initiation settings. Use the following steps to create a workflow based on an event. If you want to create a workflow that runs on a schedule, see Scheduling a Workflow.

Important:

This procedure assumes you're already familiar with workflow elements. For more information about each of the workflow elements, see Workflow Elements.

To create a workflow:

  1. In NetSuite, go to Customization > Workflow > Workflows > New.

  2. Under Basic Properties, set the following basic properties:

    Property

    Description

    Name

    Name of the workflow (up to 40 characters).

    Workflows on the Workflow list page appear with this name. This name is also used on the record for workflow instances, shown on the Active Workflows and Workflow History subtabs.

    ID

    Optional script ID for the workflow definition. This value must be lowercase, can’t have spaces, and can’t be longer than 26 characters.

    Use Script IDs if you plan to bundle the workflow and deploy it to another NetSuite account. Script IDs help avoid naming conflicts when workflows are deployed to other accounts.

    NetSuite prefixes this value with customworkflow when you save the workflow.

    You can change the script ID after you create the workflow. See Editing a Workflow Script ID.

    Record Type

    Record type where you want instances of the workflow to run. This record type can be a standard or custom NetSuite record type.

    You can specify only one base record type per workflow definition. If you choose Customer, Transaction, or Item, you can also select a sub type.

    See Workflow Base Record.

    Sub Type

    Sub type or secondary record type for customer, transaction, or item record types. Hold down the Ctrl key to select more than one.

    Description

    Optional text description.

    Owner

    User account that owns the workflow and receives email messages if errors happen during scheduled workflow actions.

    If the Release Status is set to Testing, only the workflow owner can initiate the workflow. See Release Status.

    Execute As Admin

    Means the workflow runs as a user with the Administrator role and ignores the role of the user.

    This property might give users more access than you intend. For more information about this property and usage guidelines, see Execute As Admin.

    Release Status

    Release status of the workflow. Choose one of the following options:

    • Testing. The workflow initiates only for its owner. This is the default release status for new workflows.

    • Released. The workflow initiates for any user, based on the workflow initiation properties.

    • Not Initiating. The workflow doesn't initiate, but you'll see it on the Workflow list page. Any existing workflow instances continue running.

    • Suspended. No new workflow instances are created and no existing instances run. If the workflow has scheduled workflows, transitions, or actions, none of them will run.

    See Release Status.

    Keep Instance and History

    Indicates whether the workflow history is saved in the database as the workflows run and after they finish. Execution and error log records show workflow history. You can select one of the following options:

    • Only When Testing. If you select this option, workflow history is kept only when the Release Status is Testing.

    • Never. If you select this option, workflow history is never kept.

    • Always. If you select this option, workflow history is always kept.

    By default, Only When Testing is selected when you create new workflows.

    If you select Never, workflow instance and history records are available on the record’s Active Workflows and Workflow History subtabs while the workflow is running. When the workflow is finished or is canceled, the related history records are deleted. However, if the workflow transitions to a state with the Do Not Exit Workflow box checked, history records are never deleted.

    Enable Logging

    Means that NetSuite generates a workflow execution log for each state entered during workflow execution.

    In testing mode, this box is checked by default, but in released mode, you must check the box yourself.

    For more information about the workflow execution log, see Workflow Execution Log.

    Inactive

    Means that no new workflow instances start, and the workflow doesn't appear by default on the Workflow list page.

  3. Under Initiation, select Event Based.

    Note:

    To create a scheduled workflow, see Scheduling a Workflow.

  4. Under Event Definition, set the following properties to define the workflow initiation:

    Property

    Description

    On Create | On Update

    Means that NetSuite initiates a new workflow instance when a record of the base record type is created or updated:

    • Created. NetSuite creates a record of the base type.

    • Updated. NetSuite opens a record of the base type to view or edit.

    This event can occur in the NetSuite UI or from the types of NetSuite functionality listed in the Context Type box. For more information, see Workflow Initiation and Execution Contexts and Workflows.

    Trigger Type

    The server trigger where you want a workflow instance to initiate. The workflow instance initiates and the record enters the entry state on this trigger type.

    For more information, see Workflow Triggers and Workflow Initiation Triggers.

    Event Types

    The activity that created, viewed, or updated the record. The workflow instance initiates only if the event occurs.

    For example, you can set the workflow to initiate only if a record was copied. For more information, see Workflow Event Types and Event Types Reference.

    Contexts

    The NetSuite feature used to create, view, or update the record. The workflow instance initiates only if this context occurs.

    For example, you can set the workflow instance to initiate only when the record for the workflow is created by a web service. For more information, see Execution Contexts and Execution Context Types.

    Condition

    Condition to limit when a workflow instance initiates. A workflow instance for the record type initiates only if this condition is met. Use the Condition Builder or the Formula Builder to create a condition or formula.

    For more information, see Defining a Condition with the Condition Builder or Defining a Condition with Formulas.

    Saved Search

    Saved search that returns records matching the base record type for the workflow. NetSuite runs the saved search and initiates a workflow instance if the record meets the saved search criteria.

    The saved search must have at least one filter set on the Criteria subtab.

    Note:

    An error can occur if the Saved Search filter isn't public or shared with the user or role. Ensure that saved searches are available to anyone who needs to run the workflow.

  5. (Optionall) If custom fields of type Workflow exist, set the field values under Custom.

    The Custom section doesn't appear if there are no custom fields of type Workflow in the account.

  6. Click Save. NetSuite creates the workflow with an initial state and opens it in the Workflow Manager.

    You can continue to define the workflow by adding states. See Working with States.

    Note:

    If you don't want the workflow to run, set it to inactive or set the release status to Not Initiating or Suspended before you save it. See Inactivating a Workflow and Release Status.

Related Topics

General Notices