I am updating slack modal view but it doesn't maintain selected dropdown values, on every update modal is getting reinitialized.
I want to select dropdown one and based on selection looking to populate dropdown two and on update all selected values should be maintain in the modal view.
Seeking assistance to make interactive modal view.
await client.views.update({
token: process.env.SLACK_BOT_TOKEN,
hash: view.hash,
view_id: view.id,
view: await moduleBlocks()
});
moduleBlocks (){
const modal = {
"callback_id": "create-incident-modal",
"type": "modal",
"title": {
"type": "plain_text",
"text": "Create Incident"
},
"submit": {
"type": "plain_text",
"text": "Submit"
},
"blocks": [
{
"type": "input",
"dispatch_action": true,
"element": {
"type": "static_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item",
"emoji": true
},
"options": [
{
"text": {
"type": "plain_text",
"text": "*option 1*",
"emoji": true
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "*option 2*",
"emoji": true
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": "*option 3*",
"emoji": true
},
"value": "value-2"
}
],
"action_id": "static_select-1"
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": true
}
},
{
"type": "input",
"dispatch_action": true,
"element": {
"type": "static_select",
"placeholder": {
"type": "plain_text",
"text": "Select an item",
"emoji": true
},
"options": [
{
"text": {
"type": "plain_text",
"text": "*option2 1*",
"emoji": true
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "*option2 2*",
"emoji": true
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": "*option3 3*",
"emoji": true
},
"value": "value-2"
}
],
"action_id": "static_select-2"
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": true
}
}
]
}
return JSON.stringify(modal);
}