Receiving data from custom model

Hello everyone,

I’m currently building an app that uses multiple CUSTOM_MODEL views—one embedded in the deals sidebar, and another that opens as a modal via a button click inside that sidebar.

Using the App Extensions SDK, I open the modal with OPEN_MODEL and pass data into it successfully.

  async displayModel(id: string, name: string, modelId: string): Promise<void> {
    const sdk = await this.initialize();
    await sdk.execute(Command.OPEN_MODAL, {
      type: Modal.CUSTOM_MODAL,
      action_id: modelId,
      data: {
        id: id,
        name: name,
      },
    });
  }

After the form in the modal is filled and submitted, I close the modal using CLOSE_MODEL. However, I’m unable to pass any context (e.g., customer ID or form data) back to the sidebar CUSTOM_MODEL to update the UI or trigger a snackbar confirmation.

Has anyone implemented a pattern like this? What’s the best way to send data back to the sidebar after closing a modal so I can update the view and show feedback?

Would appreciate any help or ideas—thanks in advance!

Hey!

I understand that the goal here is to make to custom modals (= iframes) communicate with each other. There isn’t a way to do this with the App Extensions SDK… But maybe you could make this work with help from WebSocket :thinking: Using this as a layer to transfer data.

1 Like

Hey @Siiri

Thanks for the suggestion. I went an alternative workaround using Broadcast Channel API. But since there is an option to send data to a custom modal. It would be nice to have the communication other way around.

Thanks for the help :slightly_smiling_face:

This topic was automatically closed after 60 days. New replies are no longer allowed.