How to set a NetSuite system date in the future or in the past for testing?

Is it possible to temporarily change the system date in NetSuite for testing scripts with a launch date? If there is no way to overload all the NetSuite date functions so that you can simulate the future or past date for a given user in the sandbox?

We have email notifications that are sent based on the number of days before the expiration of a specific NetSuite record. Instead of making users wait a few days to test this feature or change the expiration date of the recording, I want to provide a user interface so that I can change the NetSuite system date.

I would prefer that the date redefinition be user-specific and not the entire sandbox instance, so more than one user can simulate future / past dates. To redefine the date, you will need to work with both the client code and the SuiteScript server, as well as with scheduled scripts.

+4
source share
3 answers

A possible workaround is to create two script parameters. A checkbox indicating that the script is in debug mode and a debug date, where you can specify any date that you want.

Then on the script check the box. If checked, use the value in the date parameter to compare instead of the system date.

+2
source

You can create the deployment parameter field {testDays}.

In production, make it zero. In a test environment, give it some negative numbers.

create something like the following

newTempDate = nlapiAddDays ({expirydate}, {testDays})

and use newTempDate for your criteria everywhere.

+2
source

I'm not sure about the availability of such a feature in Netsuite that allows you to customize the System Date. As far as I know, your schedule scripts will always select the timestamp of the server instance. Regardless of whether you change the date / time zone, all of your transactions, records, scripts, and login times will be displayed in Pacific Time mode, where the server computer is located. One solution can determine your own date in your script instead of changing the server date (if you do not want to change the date in your entry) and confirm your entries against it.

+1
source

All Articles