In last week’s tip, we provided a quick snapshot of the pros and cons of using the workflow feature in NetSuite. We demonstrated that a workflow and a SuiteScript may be able to achieve the same result. However, sometimes one may be preferable over the other. Once you have determined that a workflow is the best solution in your situation, you are ready to create a workflow.
Gathering Your Basic Info
To begin with, navigate to the page where you can start your new workflow. You can access that page through Customization > Workflow > Workflows > New. Alternatively, you can select the “New Workflow” button at the top of your workflows page. Note that this navigation may look different if you are not logged in as the Administrator.
On the new workflows page, you will notice certain fields in the “Basic Information” section that you need to fill out. While some of these are self-explanatory, let’s walk through them to make sure we understand each one.
1. Name: Choose a memorable/relevant name for this workflow. You want the name to reflect, in the barest of terms, the primary purpose of the workflow.
- ID: You may either specify an ID or you may leave this field blank. In the latter case, NetSuite will autogenerate an ID for this workflow. If you do want a personalized ID, we would recommend making it similar to the name you gave your workflow.
- Record Type: Where do you need your workflow to run? Choose the appropriate record. This field is arguably the most important one. In fact, the success of your workflow depends on it running on the correct record. And once you save this definition of your workflow, you can never go back and edit the record type. (So no pressure, right?!)
- Sub Types: This field may be empty depending on which record you chose. However, if your record does have sub types you will need to specify which one your workflow will run on. Interestingly, you have the option of selecting multiple sub types within a record. Simply hold down the CTRL key and select the sub types you need.
- Description: This field is optional, but it’s a good idea to get in the habit of providing a brief explanation. Providing a description will help both you and your team understand at a glance exactly what your workflow does.
- Owner: This field is automatically set to you, the person who is logged in. You also have the option of selecting another employee from the dropdown list. In the vast majority of situations, however, the creator of a workflow would want to be the owner.
- Release Status: You have four options in the release status picklist: Suspended, Not Initiating, Testing, and Released. The Testing and Released options are straightforward. In the Testing status only the owner will be able to see the workflow running on its record. On the other hand, in the Release status the workflow will run for every role with access to that particular record. Use the Not Initiating status when you want the workflow to keep running on previously initiated instances but not begin any new instances. And use the Suspended status when you want to halt execution of every instance of the workflow as well as prohibit any new instances.
- Keep Instance and History: This field provides you with optional data on your workflow’s instance history. You can select Always, Never, or Only When Testing. If you do decide to select Always or Only When Testing, then you will be able to view the history of your workflow instances from the record that your workflow runs on. Your workflow history will appear on the record under the subtab System Information >> Active Workflows. You probably also want to check the Enable Logging checkbox. Doing this will ensure tracking of the workflow’s execution and provide you with a simple way to find areas where your workflow glitches during testing.
Determining the Initiation
Your next task as you create a workflow is to determine what will prompt your workflow to run. You have two options here: Event Based or Scheduled.
Do you want your workflow to run when a new record is created? Or is it something that needs to happen whenever someone views or updates the record? As the name suggests, Event Based workflows run only when prompted by specific events.
After selecting the initial checkbox(es) determining what broad events will initiate your workflow, determine the specific triggers for the workflow. The default trigger type is set to All, but you can specify Before Record Load, Before Record Submit, and/or After Record Submit. If you do choose one of these trigger types, then you will also have the option to choose an event type that corresponds with your selected trigger. As with the earlier sub types, if you hold down the CTRL key you can select multiple event types.
The remainder of your options in this section (Contexts, Condition, Saved Search Condition, and Localization Context) simply serve to further constrain situations in which your workflow would apply. The Contexts field is automatically populated with a list of preselected contexts, which you are welcome to change or leave alone as needed. The other three fields are optional—utilizing them is completely up to you and your specific situation! And for any developers out there, if you do need to use the Condition field you may choose to build your condition either with the Visual Builder or with a Custom Formula.
You will notice that the first order of business in setting up a Scheduled workflow is to select a saved search filter. NetSuite help provides the following explanation for this:
When you configure a workflow to run on a schedule, the workflow executes on the results of a saved search. The saved search you select 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.
Unlike Event Based workflows, Scheduled workflows run based on a predetermined timeline. One option is to schedule this kind of workflow to execute once on a specific date at a specific time. Alternatively, you can select the Repeat checkbox so that the workflow runs on a regular schedule. The Repeat option allows you to schedule your workflow as frequently as every 30 minutes and as infrequently as once a year. This function gives you the peace of mind that it will keep running without you needing to check up on it! If you need a repeating scheduled workflow to stop running at a specific time, set a date for the workflow to end in the Scheduled Until Date field.
After working through this blog—naming, describing, and defining your workflow—you should have a good grasp on how to create a workflow. You are now ready to click Save and begin building your workflow. I hope that, if anything, you come away from this post with an appreciation for the high level of customizability that NetSuite’s workflows provide. And we haven’t even gotten to the nuts and bolts of building a workflow yet! To keep up with this series on workflows, be sure to subscribe below to our mailing list!