Autorun AI Docs

9. Modal

Modals are blocking dialogs. Use them when the user must confirm before a destructive action.

context.modal.<type>(config)


context.modal.confirm({
  title: "Delete record",
  content: "Are you sure you want to delete this record? This cannot be undone.",
  okText: "Delete",
  okType: "danger",
  cancelText: "Cancel",
  onOk: async () => {
    await context.sdk.entities.delete({
      params: { entitySlug: "samples", recordId: context.router.id }
    });
    context.redirect("/samples");
  }
});
context.modal.info({
  title: "Information",
  content: "This record has already been fiscalized and cannot be edited."
});
context.modal.warning({
  title: "Unsaved changes",
  content: "You have unsaved changes. Please save or discard before continuing."
});
context.modal.error({
  title: "Export failed",
  content: "The file could not be generated. Please contact support."
});
context.modal.success({
  title: "Payment received",
  content: "The invoice has been marked as paid."
});

Prop

Type

The confirm handle also has update and destroy if you need to replace the body after a long task:

const modal = context.modal.confirm({
  title: "Processing...",
  content: "Please wait.",
  footer: null
});

await doLongTask();

modal.update({
  title: "Done",
  content: "The operation completed successfully."
});

On this page