Giter VIP home page Giter VIP logo

netsuite-update-expired-status's Introduction

NetSuite-Update-Expired-Status

Project Overview

statusEmail

Purpose

This project automatically sets inventory details to expired when their expiration date has passed using the Inventory Status Change record. It is a scheduled Map/Reduce script that runs every weekday at 9am and sends out a summary email of all the changes made.

Features

  • Automated Emails
  • Setting Sublist Field Values
  • Automatic Inventory Status Changes
  • Saved Searches

Prerequisites

  • SuiteScript/JavaScript
    • Modules: N/search, N/record, N/email, N/url
    • SuiteScript Types: Scheduled Script
    • API Version: 2.x
    • JSDoc Tags
  • Saved Searches

Project Setup

Saved Searches

Be sure to note the saved search ID.

  • Search for Expired Inventory By Bins:
    • Function: collects all expired inventory details, grouped by their bin numbers, lot numbers, and locations
    • Search Type: Inventory Detail
    • Criteria: Expiration Date is before today, Status is Good, Inventory Number: Available is greater than 0
    • Result Columns: Internal ID, Status, Item, Number, Location, Expiration Date, Inventory Number: Available, Bin Number, Location: Use Bins
    • Summary Types: Group the following fields: Status, Item, Number, Location, Expiration Date, Inventory Number: Available, Bin Number, Location: Use Bins
    • Sort By: Number, Bin Number, Location
    • Filters: Number, Bin Number, Item
    • Permissions: Public
  • Search for Expired Status Changes:
    • Function: collects all the Inventory Status Change records that were automatically created
    • Search Type: Transaction
    • Criteria: Type is Inventory Status Change, Date is on today, Main Line is false
    • Result Columns: Inventory Detail: Number, Inventory Detail: Expiration Date, Inventory Detail: Item
    • Summary Types: Group the following fields: Inventory Detail: Number, Inventory Detail: Expiration Date, Inventory Detail: Item
    • Sort By: Inventory Detail: Number, Inventory Detail: Bin Number, Inventory Detail: Location
    • Permissions: Public
  • Search for Expired Quantity:
    • Function: finds the quantity available in each bin; bin number, item, location, and lot number filters are applied to this to find the bin quantity
    • Search Type: Item
    • Criteria: Inventory Number/Bin on Hand: Available is greater than 0
    • Result Columns: Name, Inventory Number/Bin on Hand: Inventory Number, Inventory Number/Bin on Hand: Bin Number, Inventory Number/Bin on Hand: Location, Inventory Number/Bin on Hand: Available
    • Sort By: Inventory Number/Bin on Hand: Inventory Number, Inventory Number/Bin on Hand: Bin Number, Inventory Number/Bin on Hand: Location
    • Filters: Inventory Detail: Status, Name, Inventory Number/Bin on Hand: Inventory Number, Inventory Number/Bin on Hand: Bin Number, Inventory Number: Expiration Date, Inventory Number/Bin on Hand: Location
    • Permissions: Public
  • Search for Expired Inventory:
    • Function: collects all the expired inventory and the bin available quantities; Inventory Balance search types cannot be used in SuiteScript
    • Search Type: Inventory Balance
    • Criteria: Inventory Number: Expiration Date is before today, Status is Good, Available is greater than 0
    • Result Columns: Status, Item, Inventory Number, Bin Number, Location, Inventory Number: Expiration Date, Available
    • Sort By: Inventory Number, Bin Number, Location
    • Permissions: Public

Uploading to NetSuite

  • Adding a SuiteScript to the File Cabinet: navigate Customization>Scripting>Scripts>New; next to the "Script File" dropdown, press the plus sign to upload a new SuiteScript file; select the NetSuite folder that you want to store the SuiteScript files in; under "Select File," press the "Choose File" button; select the SuiteScript file that you want to upload and press open; save and press the blue "Create Script Record" button; name the file, input a relevant ID, and save

Adding New Inventory Status

  • Adding Expired Status to Inventory Status List: navigate List>Supply Chain>Inventory Statuses>New; input the name of the new Inventory Status as "Expired"; uncheck the boxes labeled "Making Inventory Available for Commitment" and "Make Inventory Available for Allocation and Planning"; save the new record by pressing the blue button

File Descriptions

set_expired_status.js

  • Programming Languages: JavaScript, SuiteScript 2.0
  • SuiteScript Type: Map/Reduce Script, getInputData, map, summarize
  • Description: sets the status of inventory details with expiration dates that are before today using an Inventory Status Change record
  • Catering the Code to Your NetSuite:
    • Changing the Saved Search IDs: whenever there is a search load instance (search.load), change the parameter "id" to the correct search ID
    • Sending Email to Different Recipient: find where the email is sent (email.send) at the end of the program; change the "recipients" parameter to the correct email address; add more than one recipient by putting the emails as an array of strings
    • Changing the Email Sender: find where the email is send (email.send) at the end of the program; change the "author" parameter to the correct employee internal ID; find employee internal IDs by navigating Lists>Employees>Employees and locating the correct employee; can only choose one author for the email
  • Deploying SuiteScript: go to the SuiteScript file; press the "Deploy Script" button; enter a name and relevant ID; change the status to "Testing"; press the blue "Save" button and choose "Save and Execute"; once the code has been tested, change the status to "Scheduled"; under "Execute As Role," choose "Administrator" so that the code will get full access to NetSuite and will not create any permissions errors; under the "Schedule" subtab, choose the schedule that the SuiteScript should execute on (Daily Event, Repeat every weekday, start time 9:00am)

expired_inventory

References

Helpful Links

Extra Tips

  • Choose to execute as the administrator role when deploying the SuiteScripts to make sure everyone has full permissions
  • Be sure to check the global permission in all of the saved searches
  • Go back to the script deployments to check that their status is "Released" and that their audience includes all roles

netsuite-update-expired-status's People

Contributors

elizabethpursell avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.