What steps could be taken to update a clientscript so it uses a custom record to save data instead of a search?

This is the task I was given and I am not sure how to start:

This will need to be changed from a saved search within the client script to a schedualed task to a custom record to store this data (linked to the item record)

As the current version will slow down PF’s tremendously.


Logic for the current script implementation:

Forecast sales = midpoint of Average weekly sales for past 3 months and average weekly sales for past two weeks. *1.25.

so if an item sells on average 10 a week over the past 12 weeks but has sold 15 a week for the previous two weeks the forcast sale for the next week will be 16… if the stock for this item is less than 2X this value the alert will show stating

`This items forecast sales for the next two weeks will consume our current stock

Are you sure you want to offer a discount?`

It also looks at the supplier stock and if the supplier has less than 4 weeks worth of stock available the alert will show stating

`The Supplier has low stock of this item,

Are you sure you want to offer a discount?`

The logic can be amended and changed

Rookie Asked on February 9, 2024 in SuiteScript.
Add Comment
1 Answer(s)


It looks like you will need something like a Map/Reduce script to update the items and then can probably store this in a custom field on the Item (or a custom record, if necessary).

Have you done any Map/Reduce scripts previously?



Intermediate Answered on February 12, 2024.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor