Scheduling a Workflow

When you configure a workflow to run on a schedule, the workflow executes on the results of a saved search. When you choose to initiate a workflow on a scheduled basis, you select a saved search and then define the schedule on which the workflow runs. You can schedule the workflow to run one time, every 30 minutes, or at a certain time on a daily, weekly, monthly, or yearly basis.

Before you define the schedule for the workflow, you must create the saved search. The saved search must run on the same record type as the base record type for the workflow. The saved search must also include at least one filter set on the Criteria subtab for the saved search. On the workflow definition page, select the Scheduled option, select the saved search, and set the schedule for the workflow.

Important:

When you create a saved search, make sure that you include enough filters on the Criteria subtab to limit the search results to only the records that you want to run the scheduled workflow on. If you do not include enough criteria to filter the search results by, the saved search will return too many results and the scheduled workflows will not execute as expected. For example, it may take longer for the workflow to execute than what you were expecting, which may impact the performance of other workflows.

At the scheduled time, NetSuite runs the saved search and initiates a workflow instance to run on each of the records in the search results. For example, if the saved search returns 10 records, NetSuite initiates 10 instances of the workflow. Scheduled workflows always run on all of the records in the search results, not only the records you can see on the main page (for summary type result) of the saved search.

To create a workflow that runs on a schedule, you select the saved search on which to run the workflow and select the schedule options. You can schedule the saved search and workflow to run a single time or you can select the Repeat option to run the saved search and workflow on a repeating schedule. If you want the workflow to run one time, select the saved search, disable the Repeat option, and select the Execution Date and Execution Time. If you want the workflow to run more than one time, select the saved search, enable the Repeat option, and set the related options.

Consider the following when you create scheduled workflows:

For more information about how NetSuite runs scheduled workflows, see Initiating a Workflow on a Schedule and Scheduled Trigger.

To create a scheduled workflow:

  1. Warning:

    The saved search must include at least one filter set on the Criteria subtab for the saved search. Make sure that you include enough filters to limit the search results to only the records that you want to run the scheduled workflow on.

    Define a saved search on the base record type for which you want to create a workflow.

    The saved search must also include at least one filter set on the Criteria subtab for the saved search. For more information, see Defining a Saved Search.

  2. In NetSuite, go to Customization > Workflow > Workflows > New. The workflow definition page appears.

  3. 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 must set the status to Released for a workflow to run on a schedule. However, with a release status of Testing, you can execute a scheduled workflow immediately using the Execute Now button. See Testing Scheduled Workflows.

    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.

    Note:

    This setting only impacts newly created history records. If you change the Keep Instance and History setting, existing workflows will not be impacted.

    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.

  4. Under Initiation, select Scheduled and select the saved search you created in Step 1 in the Saved Search dropdown list.

    Note:

    To create an event-based workflow, see Creating a Workflow.

  5. If you want the schedule to repeat, enable Repeat.

  6. Enter the following schedule options:

    Option

    Description

    Frequency

    The frequency with which you want the scheduled workflow to run. You can select one of the following options:

    • Every 30 minutes

    • Daily

    • Weekly

    • Monthly

    • Yearly

    If you select a daily, weekly, monthly, or yearly schedule, you need to set additional options to define the schedule.

    Default is every 30 minutes.

    Scheduled From Date

    Date on which the schedule starts. The date of the first run depends on the schedule type and schedule options.

    Scheduled Until Date

    Date on which the schedule ends. The date of the last run depends on the schedule type and schedule options.

    Execution Time

    Time of day when NetSuite runs the saved search and executes the workflow on the results. Default is midnight.

  7. If you select a daily, weekly, monthly, or yearly schedule, set one of the following related options:

    Schedule Type

    Options

    Daily

    Set the interval for the number of days between each scheduled execution, or set execution to repeat on every week day.

    Weekly

    Set the interval for the number of weeks between each scheduled execution and set the day(s) of the week.

    Monthly

    Set the specific day in the month (for example, 8th day) or the day of the week in the month (for example, second Tuesday). For both options, you can also set the time period (for example, every 2 months). You can set the following options for the occurrence of the day:

    • first

    • second

    • third

    • fourth

    • last

    Yearly

    Set the specific day in a specific month (for example, 8th of September) or the day of the week in a specific month (for example, second Tuesday in September). You can set the following options for the occurrence of the day:

    • first

    • second

    • third

    • fourth

    • last

  8. Click Save. NetSuite creates the workflow and opens the workflow in the Workflow Manager.

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

Related Topics

Working with Workflows
Creating a Workflow
Creating a Workflow from a Workflow Template
Viewing Existing Workflows
Editing a Workflow
Working with States
Working with Actions
Working with Transitions
Working with Conditions
Working with Custom Fields
Initiating a Workflow on a Schedule
Scheduled Trigger

General Notices