twiliotwilio-studio

TwilioStudio - What is the best way to clear a variable in my flow?


I'm facing an issue where I need the variable to have a clean value. Right now, I'm developing an IVR, and at certain points, I need to validate the user's document. If they input incorrect information, there's a possibility for them to correct it, but the variable still retains the previous value.

I thought about creating a script to do this, but I believe there might be a smarter way using the studio.

I created a set variables widget with the key widgets.validaCpfCnpj.parsed.formattedValue and the value " ", but it doesn't work.


Solution

  • From what you've described, it sounds like you're on the right track but facing a common challenge.

    Unfortunately, you can't directly clear properties of other widgets' variables in the Studio. However, you can employ using the "Set Variables" widget, which can help manage the variable values more effectively.

    1. First, use the "Set Variables" widget to copy the relevant value from the widget's property that you intend to clear.
    2. After performing the necessary validation or correction, use the "Set Variables" widget again, this time to set that variable explicitly to an empty value or a default value that indicates a 'cleared' or 'reset' state.