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

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: “:wave: 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: “:hourglass_flowing_sand: 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.