Creating a Workflow

When you create a workflow, you specify the basic workflow properties, event initiation, and workflow initiation properties. Use the following procedure to create a workflow based on an event. If you want to create a workflow to run on a schedule, see Scheduling a Workflow.

Important:

This procedure assumes you are familiar with the elements of a workflow. 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 for the workflow. Can be up to 40 characters.

    Any workflows on the Workflow list page or workflow instances on the Active Workflows and Workflow History subtabs for the record appear with this name.

    ID

    Optional script ID for the workflow definition. This value must be lowercase. It cannot include spaces or exceed 26 characters.

    Use Script IDs if you plan to use the SuiteBundler feature to bundle the workflow and deploy it into another NetSuite account. Script IDs reduce the risk of naming conflicts for workflows deployed into other accounts.

    NetSuite prepends customworkflow to this value when you save the workflow definition.

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

    Record Type

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

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

    See Workflow Base Record.

    Sub Type

    Secondary record type for Customer, Transaction, or Item record types. Hold down the CTRL key to select multiple sub types.

    Description

    Optional text description.

    Owner

    User account that is the owner of the workflow and receives emails for errors that occur during scheduled workflow or scheduled workflow action execution.

    With a Release Status of Testing, only the workflow owner can initiate the workflow. See Release Status.

    Execute As Admin

    Indicates the workflow runs as a user with an administrator role and ignores the role of the user that initiates the workflow.

    Using this property may give unintended levels of access for the user that initiates the workflow. For more information about this property and usage guidelines, see Execute As Admin.

    Release Status

    Release status of the workflow. You can select one of the following options:

    • Testing. The workflow only initiates for the Owner of the workflow. This is the default Release Status setting for new workflows.

    • Released. The workflow initiates for any user, according to the workflow initiation properties.

    • Not Initiating. The workflow does not initiate, but is visible on the Workflow list page. Any existing workflow instances continue running.

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

    See Release Status.

    Keep Instance and History

    Indicates whether the history records for workflows are saved in the database as the workflows run and after they complete. Workflow history records appear in the form of execution and error log records. You can select one of the following options:

    • Only When Testing. When you select this option, workflow history records are kept only when the Release Status of the workflow is set to Testing.

    • Never. When you select this option, workflow history records are never kept.

    • Always. When you select this option, workflow history records are always kept.

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

    When you select the Never option, workflow instance and history records are viewable on the record’s Active Workflows and Workflow History subtabs while the workflow is running. When the workflow is finished running or is canceled, the history records related to the workflow instance’s execution are deleted from the database. History records are never deleted for workflows that transition to a state with the Do Not Exit Workflow box enabled.

    Enable Logging

    Indicates that NetSuite generates a workflow execution log for each state entered by the workflow during workflow execution.

    For workflows in testing mode, this property is enabled by default. For workflows in released mode, you must manually enable this property.

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

    Inactive

    Indicates that no new workflow instances initiate for the workflow and the workflow does not 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

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

    • Created. A record of the base record type is created in NetSuite.

    • Updated. A record of the base record type is opened for view or edit in NetSuite.

    This event can occur in the NetSuite UI or by one of 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 on which 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 resulted in the record being created, viewed, or updated. The workflow instance initiates only if the event occurred.

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

    Contexts

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

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

    Condition

    Condition to limit the initiation of a workflow instance. A workflow instance for the base record type only initiates 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, Defining a Condition with Expressions, or Defining a Condition with Formulas.

    Saved Search

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

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

    Note:

    An error can occur if the Saved Search filter is not public and not shared with the user or role. Ensure that saved searches are available to the users and roles that execute the workflow

  5. Optionally, if custom fields of type Workflow exist, set the field values under Custom.

    The Custom section does not appear of there are no custom fields of type Workflow in the NetSuite account.

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

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

    Note:

    If you do not 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