https://discord.gg/botpress logo
#🤝help
Value is not captured after failed validation and correct retry
# 🤝help
f

fancy-fireman-70630

07/07/2023, 6:51 AM
I created a validation function for phone numbers and it works and then I set up a number of retries. When I tried to test it out by providing correct value after retry it had passed validation, but it was not captured though it claims it was as you can see on the screenshot
a

acceptable-kangaroo-64719

07/07/2023, 11:31 AM
Hey @fancy-fireman-70630 what does your capture card look like?
f

fancy-fireman-70630

07/07/2023, 3:58 PM
sorry for late response, still couldn't figure it out
a

acceptable-kangaroo-64719

07/07/2023, 4:06 PM
is your workflow variable
phoneNumber
a string or number? There could be a type error preventing it being saved if the varType is string but the phone number is a number.
f

fancy-fireman-70630

07/07/2023, 4:11 PM
I tried both and had the same issue
a

acceptable-kangaroo-64719

07/07/2023, 4:13 PM
are you moving between workflows or is everything in main?
f

fancy-fireman-70630

07/07/2023, 4:14 PM
Just main
a

acceptable-kangaroo-64719

07/07/2023, 4:18 PM
hmm. Would you mind sharing your bot?
no like the .bpz file
f

fancy-fireman-70630

07/07/2023, 4:23 PM
I tried the published bot and it behaves so weird lol. Like works completely random rather than in the editing dashboard
a

acceptable-kangaroo-64719

07/07/2023, 4:35 PM
ok I figured out what was going on. Something was happening when the single choice type was set to "number" or "phone number" and custom validation was enabled. I found that either of these worked: * Set the choice type to raw input and keep your regex validation * Set the choice type to phone number and disable regex validation
I'm not sure why this happens, but at least we have a workaround now 😅
have you published your bot recently? The published bot won't update automatically, you need to press the publish button manually every time you want changes to go live. Sort of like having a dev/production setup.
f

fancy-fireman-70630

07/07/2023, 4:37 PM
Thanks I'm going to try to do it rn
Basically nothing worked so I just gave up on the validation section in the capture card, it doesn't seem to work properly. I solved it instantly by writing simple condition in the Execute code card that sets the variable to undefined if it doesn't match my criteria. An expression card then loops the info capturing node if the phoneNumber variable is undefined. Should have done it earlier, either way thank you, Gordy.
2 Views