I want to display 2 button on each row one for update and another for delete how to implement that below is my code and output

var elements = ;
for (var i = 0; i < context.fetchAllPayeeService.response.body.queryResult.length; i++) {
var element = {
name: context.fetchAllPayeeService.response.body.queryResult[i].name,
bankName: context.fetchAllPayeeService.response.body.queryResult[i].bankName,
accountNumber: context.fetchAllPayeeService.response.body.queryResult[i].accountNumber,
status: context.fetchAllPayeeService.response.body.queryResult[i].status,
updatePayload: “update_” + i,
deletePayload: “delete_” + i
};
elements.push(element);
}

var message = {
“type”: “template”,
“payload”: {
“template_type”: “table”,
“text”: “Account details”,
“columns”: [
{“header”: “Name”, “align”: “center”},
{“header”: “Bank Name”},
{“header”: “Account Number”},
{“header”: “Status”},
{“header”: “Actions”, “align”: “center”}
],
“table_design”: “regular”,
“speech_hint”: “Here is your account details”,
“elements”: elements.map(element => ({
“Values”: [
element.name,
element.bankName,
element.accountNumber,
element.status,
{
“type”: “buttons”,
“buttons”: [
{
“type”: “button”,
“text”: “Update”,
“payload”: element.updatePayload
},
{
“type”: “button”,
“text”: “Delete”,
“payload”: element.deletePayload
}
]
}
]
}))
}
};

print(JSON.stringify(message));

image

Hi @rustama,

Thank you for reaching out to Kore.ai Community.
We will review the code and share our inputs on your requirement.

Thank you,
Srujan Madderla
Kore.ai Community Team

1 Like

Hi @rustama,

Could you please refer to the below community post and confirm if this works for your requirement.

Thank you,
Srujan Madderla

No i want 2 button in each row one for update another for delete like how in website have not outside the table and when we click on delete button that row should be deleted and for update it will give option to update lets only i want delete option in each row is it possible to achive button
in table template beacuse its showing [object] instead of delete .

Hi Kore team, how to handle response from table, after click on a button/data present in the table. It is going to next node without waiting for table-button click. unlike in button template, Can you Please guide on this usecase !!