Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Javascript Typeerror: Cannot read properties of undefined

I have the functions as below. But its throwing the error "Cannot read properties of undefined (reading 'newQuoteInventoryCheck')". I have been trying to figure what i did but couldn't solve it. I need some help in understanding and solving the problem.

updateInventory(newData){
    if (newData.id =="" || newData.id == null){ 
        (this.sales_oder.items).forEach(function (items, i) {
                        this.newQuoteInventoryCheck(items.product_id.id, items.quantity, function(uData){
                            if(uData[2]){
                                console.log('success');
                            }
                            else{
                                console.log('failed');
                            }
                        });
        });
    }
}

newQuoteInventoryCheck(newItem, added_quantity, cb){
    Api.get('materials/get/'+newItem).then((data)=>{
        let available_quantity = data.quantity;
        if (added_quantity <= available_quantity){
            cb([newItem,(available_quantity - added_quantity),true]);
        }
        else{
            cb([newItem,0,false]);
           // $('#maxquantityavailable').text('Total quantity available for "'+ data.name+'" in inventory is: '+available_quantity);
           // $('#maximum-quantity-exceeded-modal').modal('show');
            
        }
        return null;
        
    });
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!