Code Bloack error

I have a simple code block:

sayit is my global variable defined in VF, set with 0;

var a = 1;
if (a > 10)
{
sayit = 1;
}
else
{
sayit = 2;
}

This block does not get executed with error:
unable to resolve code “Invalid Parameters”

Can someone help me understand what’s wrong or if I am missing something?

did you create and set variable sayit correctly?

Not sure what is meant by “correctly”? The variable is defined and set to 0. Is there anything else? Just curious…

your code looks ok, but invalid parameters actually happens in my end when variable sayit is not set. That’s why.

  • check if variable sayit is defined correctly.
  • check if variable sayit is set to 0 correctly.

Thanks, let me check again.

you can check your variables in “Interaction Model Manager”.

s_124

Yes, I checked these points. All are in place and still I get error.

You are an experienced person in VF and hence I am taking liberty to ask you this:

In fact, I am facing so many errors even simple Javascript statements. Even the Javascript statement copied from the Voiceflow documentation gives me error.

It is so frustrating!! Do you know if this is a common experience or I must be doing something wrong? If so what’s the alternative? I have a free plan and it does not get any support from VF. Will it help if I upgrade to a paid plan?

I know it’s frustrating when not working. That’s why I answered here.

In fact, I am facing so many errors even simple Javascript statements. Even the Javascript statement copied from the Voiceflow documentation gives me error.

Which code? I’ve tested some codes below and all those work. If you tried other codes, can you point it? I will check.

https://docs.voiceflow.com/#/blocks/code-block

I tested your codes in the previous post and it works. So, there must be a tiny problem in somewhere. That’s why I asked some questions before, which you may feel it is not related to your problems, but for me, set block can be sometimes a sticking point.

If you need more support, you can go to facebook group, too.