Scripts

Last updated

There are multiple scripts that have been created as part of the Onetrail bundle install. These are a mix of different types. The only scripts that will need to be looked at as part of the bundle install are the Scheduled Scripts which will need to be deployed to run at certain times. These scripts can also be run manually.
In total there are 8 scripts which need to be scheduled.

Overview

There are four sets of data which are retrieved from Onetrail – Product Information, Order Responses, Despatch Advices and Supplier Invoices. Product Information is updated daily but other messages can be generated at any time of day. To retrieve and process the messages, scheduled scripts have been created. The script deployments should be updated to set an appropriate time and frequency of execution. Each message type has a pair of scripts – one to retrieve (download) and store the messages and one to process the stored messages. These are detailed in the sections below.


Please note: do not schedule the Product Info scripts straight away. As soon as the scripts are scheduled to run and Vendors have been enabled (from section 5.4), Items will start to be created in NetSuite. If using Pricing Rules and Product Classifications it is important to get these correct before bringing in the Items. It is recommended to import a few items at once. To do this, deploy the Onetrail.net Product Info WebSvc (sch) script, then mark all responses as Inactive (section 7.5) except for 1 record. Run the Onetrail.net Product Info Processing script which will process the records in there. This will create a number of Items, which can easily be reviewed. If information is incorrect, you can delete the created items. If you then edit the eInteract Saved Response record, change status from Completed to Downloaded and then you can re-run the Onetrail.net Product Info Processing script. Once you are happy that the Items are being created as expected, mark all saved responses as active and re-run the script.

Message Download Scripts


Messages downloaded by these scripts will be stored as Onetrail.net Saved Response custom records, with an initial status of “Downloaded”. Daily product information updates may consist of several (20-50) messages with up to 500 products in each message. Note: If Onetrail have enabled the Receive Service several days before the bundle is installed and this script deployed, there could be a significant backlog of messages to download.

Message Processing Scripts

These scripts perform the actual updates of NetSuite by processing the Saved Response records. Each script will re-queue itself as necessary until all downloaded records have been processed.

Once Product Info messages are being downloaded and processed, items will be created or updated

Considerations for Scheduling the Scripts

As mentioned above there are 8 scripts in total, related to 4 different sets of information, each which has 2 scripts. The message download script retrieves data and creates a record in NetSuite, then the processing script publishes the information. The message download script must happen before the message processing script.

As Product Information is only released at night by Onetrail, the Onetrail.net Product Info WebSvc (sch) and Onetrail.net Product Info Processing scripts should be scheduled to be only run once a day in the middle of the night, for example 3am.

The other three sets of data could be received at any point form the Supplier/Vendor. Therefore these scripts can be run regularly throughout the day, for example every 1 hour.

PLEASE NOTE: Be particularly careful with the Vendor Invoice Scripts as there is a NetSuite setting that can have an effect. In Accounting Preferences, there is a field called ‘Bill in Advance of Receive’. If this field is not ticked, then a Bill/Supplier Invoice cannot be created until the PO has been marked as received.

Often the Suppliers/Vendors will send the Despatch Advice and Vendor Invoice in very quick succession. If the Invoice Scripts are scheduled to run shortly after the Despatch Note scripts, we may miss the Despatch Note notification but pick up the Invoice one. As there is no Item Receipt/Fullfillment in NetSuite (we have not processed the Despatch Note script), the Invoice will be rejected when it is trying to be created. 

It is therefore recommended to run the Vendor Invoice scripts less regularly, for example only twice a day. However the Order Responses and Despatch Advices can be run more regularly, for example once an hour.

Other Scripts to Consider

Other scripts should already be set up to be running as required. However some scripts may only be deployed to certain roles and therefore will not work by default for Custom Roles. To resolve this, you will need to edit the Audience on the script deployments. Scripts that need to be updated are:

•    Item Form Price and Avail Lookup Button

Manually Running the Scripts

The scheduled scripts detailed in sections 6.2 and 6.3 can be run manually, as well as being scheduled. A shortcut has been added at Transactions > Custom Records > eInteract Process Starter. From here you can run the 8 scripts.

 

Next Chapter: Custom Records
var _glc =_glc || []; _glc.push('all_ag9zfmNsaWNrZGVza2NoYXRyDwsSBXVzZXJzGMTP7pYDDA'); var glcpath = (('https:' == document.location.protocol) ? 'https://my.clickdesk.com/clickdesk-ui/browser/' : 'http://my.clickdesk.com/clickdesk-ui/browser/'); var glcp = (('https:' == document.location.protocol) ? 'https://' : 'http://'); var glcspt = document.createElement('script'); glcspt.type = 'text/javascript'; glcspt.async = true; glcspt.src = glcpath + 'livechat-new.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(glcspt, s);