Update:
This is the right syntax for the return which will tell the value of the parameter:
e.commonEventObject.parameters
And correct syntax for the function:
function buildCategoryCardV2(categories) {
const buttons = categories.map(category => ({
text: category,
onClick: {
action: {
"function": "handleCardClick",
"parameters": [
// Pass the variable's value as a parameter
{ "key": "categoryPressed", "value": category }
]
}
}
}));
const card = {
cardId: 'category_selector',
card: {
name: 'Category Selector',
header: { title: 'Inventory Request', subtitle: 'Please select a category' },
sections: [{ widgets: [{ buttonList: { buttons: buttons } }] }]
}
};
return card;
}