ANS-1608 · SUITESCRIPT DEVELOPMENT

How to Process Weekly Time Entries with SuiteScript afterSubmit

Understand how NetSuite converts weekly time entries and leverage SuiteScript afterSubmit for post-submission record updates.

Short answer

When a weekly time entry is saved, NetSuite converts it into individual daily entries. To manage custom field values or perform additional logic, an afterSubmit SuiteScript can be used. This script must explicitly load the newly created record for modifications and include conditions to prevent redundant execution.

Scenario

Organizations using NetSuite's weekly time tracking feature often require custom logic or field updates after time entries are submitted. The challenge lies in understanding how NetSuite processes weekly entries into individual daily records and how to effectively apply post-submission scripting for these converted records.

Solution

When a weekly time tracking form is saved, NetSuite automatically converts the aggregated weekly entries into individual daily time entries, processing them column by column and row by row. For solutions involving custom fields where values need to be managed or updated post-submission, an afterSubmit user event script can be utilized. It is crucial to note that within the afterSubmit context, the newRecord object is read-only. To perform additional updates to the newly created record, the script must explicitly load the record, apply the necessary modifications, and then submit it. To prevent the script from executing redundantly or causing infinite loops, a condition should be implemented, often based on a custom field. This custom field's value will differ when set on a weekly time entry form (column-level) versus a daily time entry form (header-level), allowing the script to differentiate the context of execution.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant