Workflow Instance, History and Logging

07/21/2023 10:21 PM - By MavenCloud

When developing any automated or semi-automated process in any system, one of the hardest most tedious things can be troubleshooting incorrect results or errors that occur.  When writing script or code, debugging can be an arduous task for even the most accomplished developer.  When using workflows in NetSuite, there is also a large element of debugging or troubleshooting that occurs throughout the development of the workflow and even after it has been deployed.  Luckily, NetSuite has provided a few useful tools to help with this process.

In the initial setup and configuration of your workflow there are two settings you can use to enable these helpful tools.  They are the "Keep Instance and History" setting and the "Enable Logging" setting.




With these two settings you can implement NetSuite's backend logging capabilities to help you review what happened to the record throughout the workflow and where you may have configured an action or transition incorrectly.

Keep Instance and History

NetSuite offers a few different configuration settings for this function to give developers more flexibility around when and how Instance records should be kept for records within your workflows.  The available options are:

  • Always - which means workflow history will always be kept under the System Notes tab of the record being affected by the workflow and saved there indefinitely.
  • Never - the system will log the workflow history for a record while it is actively within the workflow, but once it leaves the workflow or the workflow is canceled all instance and history records will be deleted from the database.
  • Only when Testing - the system will only maintain workflow history for records while the workflow release status is set to Testing, but not for any other release status.  When the workflow is transitioned to the Released status the system will log the workflow history for a record while it is actively within the workflow, but once it leaves the workflow or the workflow is canceled all instance and history records will be deleted from the database.
To explain when instance and history records we will look at an Expense Report that initiated an approval workflow.  You can find the workflow history under the System Information subtab on any record.

Here you can see the record began in the INITIATE state and moved through the workflow until it reached the REJECT state, where it still currently sits as there is no DATE EXITED STATE value listed.  This is your first step into troubleshooting workflow issues as you can quickly see if the record transitioned to the correct states per your expectations as the developer.  You can also see the date and time the record transitioned between states which can be helpful when compared to the System Notes as you can see different field values that changed and what date or time that change occurred.

Workflow Logging

To expand upon the wealth of information that workflow history records can provide you can also dive deeper into each action and transition executed in each state by using the Enable Logging feature.  When this checkbox is checked the "Log" link will appear next to each workflow instance under the Workflow History sublist.


When you click on this link a popup will appear that shows every action and transition contained within that state and what condition was met to trigger each action.


Here we have an enormous amount of information showing each action performed the trigger used, the condition met and even the values set by each workflow action.  We can also see transitions and why they were triggered and in what context.  This is incredibly helpful during the troubleshooting phase of your development to see where you might have configured something incorrectly or the logic of a condition might be a little off.

You can also toggle the "Show Rejected Actions/Transitions" checkbox to see actions that are setup within the workflow state, but maybe did not executed and the reason why the did not execute.


This logging is the most helpful tool for troubleshooting workflow issues and errors.  We usually recommend that you enable logging for the initial development of workflows and also for the first few weeks after deployment of any workflow to help quickly fix any issues that may arise during the "hyper-care" phase after implementation.  However, once a workflow has been running successfully for a few weeks or even a few months it might be a good idea to disable logging as the workflow instance logs and workflow logs do take up database room and require system resources to create, access and maintain.

Deleting Workflow Logs

A very little known feature of workflows is the fact that you can delete or remove these logs and history records for workflows from the system if you feel they are no longer needed.  This can be very helpful when performing system clean up efforts or just trying to remove unwanted "junk" from your system.

In your workflow if you hover over the "more..." link in the upper right hand corner you can select the "Instance and History Records" option from the drop down menu.



In the pop up window enter the number of months in the past you would like to keep these instance and history records, or enter zero in this field to delete ALL history records for this workflow.  Then click the delete button.


Upon successful completion of the deletion the pop up window will disappear and you can continue to configure your workflow as needed.

As you can see workflow history and workflow logs can be extremely helpful to troubleshoot any issues or errors that may arise from your workflow, but make sure to only use them when absolutely necessary.  It does not help to load your system up with years worth of workflow logs when you are only experiencing a few errors or issues throughout the year.  It would be better to turn off logging and when issues arise try to quickly enable logging and recreate the record or transaction the same way to catch the error, then disable logging again after a fix is in place.

If you appreciated this insight into workflows or would like to learn more about workflows and other NetSuite customizations be sure to subscribe to our blog or follow our LinkedIn page for more great content.

MavenCloud