Integration >> Fail option does not return correctly

I’m currently using Integration > GET with Google Sheets. That means every time User input a value that match with item in Sheets, the operation is considered successful. But if the input is not in the Sheets, the operation is considered failed. If it’s failed, a Fail-Speak-block will be triggered. The problem is when it’s failed, the Success-Speak-block is still triggered, with variables = undefined. I don’t know how to fix this. Please help me out. Thank you!

fail option of integration block is for errors like cannot access to google sheets, not for match nothing.

so you should check if variable is undefined or not using IF block after integration block. also, “undefined” is special meaning in IF block, this does not work.

use expression of IF Block, and condition should be “{variable} == undefined”, then it will work.

  1. remove “=”

  1. click “</>” and choose “expression”

  1. fill in like this

1 Like

Thank you for your answer. Here’s what I mean with the undefined. This is the CORRECT one.

This is the INCORRECT one.

The Company Code HPG is in the db in GSheets. When I ask something that not in the db, they still return the Success-Speak-block, not the Fail-Speak-block, just change all the variables to UNDEFINED.

that’s correct behaviour. as I said,

this means if there’s no recoed to be matched, it will go to success path and values in variable wmapped in integration will be ‘undefined’.

That’s why you need to put IF block after success path of Integration block and check if values are returned correctly or not.

whole flow will be like this, I think.

1 Like

It works like a charm. Thank you so much! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

This has worked great for me but it just starting returning error var not found. Was there a change to VF?

BTW, this is fixed now.

Hi @kun432
I’m trying to apply your suggestion but when I use the expression {variable}==undefined I receive thi error
Immagine 2022-03-31 182258
And if I quote the word ‘undefined’ as suggested, the fix doesn’t work.


try this one

typeof {prodotto} === 'undefined'

Hello @kun432
Your solution is working! Thank you very much.

Meanwhile I found a workaround for this: In Google sheet block I asked voiceflow to retrieve also the “Row number” and, if there weren’t the “product” element in the sheet, the block couldn’t mapping the Row in a variable and treated this as a Failure (red path of Google Sheet block).

With your code it avoids this alternative.

Thanks again

1 Like