Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7825209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:52:31+00:00 2026-06-02T08:52:31+00:00

The issue I am having is I am consistently getting the following error when

  • 0

The issue I am having is I am consistently getting the following error when executing a user event script in NetSuite:

TypeError: Cannot read property "amazon" from undefined

NetSuite uses Javascript to do the business logic on both client and server side. For those without NetSuite experience, a user event script is executed on the server.

The code I can share is as follows:

var qtyAvail = 0; 
qtyAvail = rec.getValue('locationquantityavailable');
if(!qtyAvail || qtyAvail === 'undefined' || qtyAvail === null || isNaN(qtyAvail) || typeof qtyAvail === "undefined"){
                qtyAvail = 0;

            }   
  location = rec.getValue(kColumns[3]);
            if(location == 7 ||location == 16 ||location == 20 ||location == 3 ||location == 19 ||location == 1 ||location == 27 ||location == 27){    
                if(location == 7){
                    fba = qtyAvail;
                    if(!fba){
                        qtyAvail = 0;
                    }                    
                }
...more business code here....
 return {

            amazon: fba,
            ups: upsName
 }

I am calling the return values like:

var itemQty = getLocationQty(item);
           if(itemQty.amazon){
               var fbaStock = itemQty.amazon;
           } else { fbaStock = 0;}

This code works fine for some of my locations, but if there is not quantity available in a specific location it is returning undefined, rather then setting the qtyAvail to 0 as I would expect.

Am I missing a comparison for checking undefined anywhere, or does anyone else see any issues with the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:52:32+00:00Added an answer on June 2, 2026 at 8:52 am

    From the snippet you included it looks like you are not initializing the value of fba.

    Add var fba=0; at the start and see if that fixes it.

    Or perhaps you meant to assign qtyAvail to amazon instead of fba.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue executing a Python script from a PHP script. My client
I am encountering an issue where having a ending script tag inside a quoted
I am having an issue getting Chrome to display my rounded corners on a
I'm having an issue with an event handler in SharePoint. I have a list
This issue is so deceptively simple that I'm having trouble getting my head around
Im having issue when a user uploads and try's to crop a PNG or
I having issue that content assistant / intellisense is working in methods such as
i am having issue with loading my selector via a jquery ajax load call
In analysis of energy demand and consumption data, I'm having issue re-sampling and interpolating
Im having an issue doing something thats probably pretty simple. My LINQ query is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.