OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Not able to open another modal after submitting the Slack Modal from AWS Lambda after data submission. Using slack bolt and Javascript

  • Thread starter Thread starter Tushar Wagh
  • Start date Start date
T

Tushar Wagh

Guest
Code is

// Handle selection of a pending task in the static select

**app.action(

{ type: "block_actions", action_id: /^pending_task_action_(\d+)$/ },**

async ({ ack, body, client }) => {

await ack();

const selectedOption = body.actions[0].selected_option.value;

const selectedApplicationId = body.actions[0].block_id;

const userEmail = body.user.name + "@test.com";

// Open a modal with a text input for reason

await client.views.open({

trigger_id: body.trigger_id,

view: {

type: "modal",

callback_id: "reason_modal",

private_metadata: JSON.stringify({

selectedOption,

selectedApplicationId,

userEmail

}),

title: {

type: "plain_text",

text: "👋 Please comment ",

},

blocks: [

{

type: "input",

block_id: "reason_input",

element: {

type: "plain_text_input",

action_id: "reason",

multiline: true,

},

label: {

type: "plain_text",

text: "Please provide comment for your action:",

},

},

],

submit: {

type: "plain_text",

text: "Submit",

},

},

});

}

);



Here the next quick modal is not getting opened.

// Handle submission of the reason modal

**app.view('reason_modal', async ({ ack, body, view, client }) => { ** await ack();

// Open a quick loading modal

const initialModal = await client.views.open({

trigger_id: body.trigger_id,

view: {

type: "modal",

title: {

type: "plain_text",

text: ":man-biking:Processing..",

},

blocks: [

{

type: "section",

text: {

type: "plain_text",

text: "⏳ Please wait while we process your request...",

},

},

],

},

});

Tried sending response acknowledgement but didn't worked.

Cannot directly close the reason_modal as i have to show other modals as well after main comment modal.

<p>Code is</p>
<p>// Handle selection of a pending task in the static select</p>
<p>**app.action(</p>
<p>{ type: "block_actions", action_id: /^pending_task_action_(\d+)$/ },**</p>
<p>async ({ ack, body, client }) => {</p>
<p>await ack();</p>
<p>const selectedOption = body.actions[0].selected_option.value;</p>
<p>const selectedApplicationId = body.actions[0].block_id;</p>
<p>const userEmail = body.user.name + "@test.com";</p>
<p>// Open a modal with a text input for reason</p>
<p>await client.views.open({</p>
<p>trigger_id: body.trigger_id,</p>
<p>view: {</p>
<p>type: "modal",</p>
<p>callback_id: "reason_modal",</p>
<p>private_metadata: JSON.stringify({</p>
<p>selectedOption,</p>
<p>selectedApplicationId,</p>
<p>userEmail</p>
<p>}),</p>
<p>title: {</p>
<p>type: "plain_text",</p>
<p>text: "👋 Please comment ",</p>
<p>},</p>
<p>blocks: [</p>
<p>{</p>
<p>type: "input",</p>
<p>block_id: "reason_input",</p>
<p>element: {</p>
<p>type: "plain_text_input",</p>
<p>action_id: "reason",</p>
<p>multiline: true,</p>
<p>},</p>
<p>label: {</p>
<p>type: "plain_text",</p>
<p>text: "Please provide comment for your action:",</p>
<p>},</p>
<p>},</p>
<p>],</p>
<p>submit: {</p>
<p>type: "plain_text",</p>
<p>text: "Submit",</p>
<p>},</p>
<p>},</p>
<p>});</p>
<p>}</p>
<p>);</p>
<hr />
<p>Here the next quick modal is not getting opened.</p>
<p>// Handle submission of the reason modal</p>
<p>**app.view('reason_modal', async ({ ack, body, view, client }) => {
**
await ack();</p>
<p>// Open a quick loading modal</p>
<p>const initialModal = await client.views.open({</p>
<p>trigger_id: body.trigger_id,</p>
<p>view: {</p>
<p>type: "modal",</p>
<p>title: {</p>
<p>type: "plain_text",</p>
<p>text: ":man-biking:Processing..",</p>
<p>},</p>
<p>blocks: [</p>
<p>{</p>
<p>type: "section",</p>
<p>text: {</p>
<p>type: "plain_text",</p>
<p>text: "⏳ Please wait while we process your request...",</p>
<p>},</p>
<p>},</p>
<p>],</p>
<p>},</p>
<p>});</p>
<p>Tried sending response acknowledgement but didn't worked.</p>
<p>Cannot directly close the reason_modal as i have to show other modals as well after main comment modal.</p>
 

Latest posts

Online statistics

Members online
0
Guests online
5
Total visitors
5
Ads by Eonads
Top