Question

TypeError: Cannot read property 'toString' of undefined

  • 19 July 2022
  • 3 replies
  • 2069 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'};

3 replies

Userlevel 7
Badge +14

Hi @besophro 

Good question.

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

 

JavaScript

if (lineItemsVariationID) {
XXX
}

 

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

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'};}

Reply