Skip to main content
Question

TypeError: Cannot read property 'toString' of undefined

  • July 19, 2022
  • 3 replies
  • 2899 views

This is for a customer note on a couple of zaps wondering how to clear the error. It looks like the zap is working with still sending the information to Active Campaign but it still sends errors. Any help appreciated. // this is wrapped in an `async` function// you can use await throughout the functionreturn { line_items_ids: inputData.lineItemsVariationID.toString(), line_tags: (inputData.tags==undefined || inputData.tags.indexOf('subscrib')==-1)?'[product] online course (Empowerment),[stage] customer':'[product] online course (Empowerment),[stage] customer,[stage] subscriber'};
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • July 19, 2022

Hi @besophro 

Good question.

Try adding an IF condition to the Code step to check if the lineItemsVariationID value exists.

 

JavaScript

if (lineItemsVariationID) {
XXX
}

 


  • Author
  • Beginner
  • July 20, 2022

Thank you so much for the quick response I wrapped the code block in the if statement and we will see if that works.  


  • Author
  • Beginner
  • July 21, 2022

with wrapping the code I am still receiving the alerts for possible error on my zaps. They are all working and connecting to the right applications but everytime the zap is run I get an email saying

 

TypeError: Cannot read property 'toString' of undefined

\

 

here is the code from the zap

// this is wrapped in an `async` function// you can use await throughout the function// this is wrapped in an `async` function// you can use await throughout the functionif (lineItemsVariationID) {return { line_items_ids: inputData.lineItemsVariationID.toString(), line_tags: (inputData.tags==undefined || inputData.tags.indexOf('subscrib')==-1)?'[product] online course (Empowerment),[stage] customer':'[product] online course (Empowerment),[stage] customer,[stage] subscriber'};}