Card Block Internal Value for Dynamic Data
Reproduction
1. Set some variables that are arrays of strings, such as
teamsIds
, teamsNames
and teamsCities
2. Connect a Card block, with dynamic data: {{teamsNames}}
as its Title
, {{teamsCities}}
as its Description
, and an arbitrary string for the button such as Check Team Matches
3. Try to put {{teamsIds}}
as the Card's Internal value
4. Preview the bot
Desired behavior
I want the internal value of a selected card to be dynamic — in this case the ID associated with the team from the teamsIds
array.
Sample data:
const teamsIds = [12, 4]
const teamNames = ["Hawks", "Celtics"]
const teamsCities = ["Atlanta", "Boston"]
When the user clicks on the Card with Celtics
as its Title
, I want the internal value of the selected card to be its associated ID in teamsIds
, which is 4
in this case.
That internal value (selected card) should also be saved in a variable selectedTeam
.
Suspected issue
Internal value
seems to only work as expected when the data isn't dynamic and that the internal value is a fixed string, regardless of which option we selected.
The Save in variable
option only allows to save a specific field from the card (like "Title", "Description" etc.) and not its internal value (which defeats the purpose of an internal value aside from solely displaying it to the user?).
↓ In the following example, I set the arrays variables with a Script
block that simulates the API call I'll make in production (which you get a peek at below it), with setVariable()
lines.
I confirm that the variables are created and with the expected data, as the cards are successfully dynamically generated from them.
4 Replies
Bot preview
TL;DR: clicking on "Check matches" should set a
selectedTeam
variable to the ID of the selected team.
Thanks for the detailed report!
Just pushed a fix 🙂
available in 10 min in production
build failed. Pushing tomorrow