ERPNext Popups/Dialogs in Forms?

I’d like to add a “Log a call” Dialog on the Lead form.

I want a dialog/pop-up modal that will allow me to create a new Communication Document that’s linked to the Lead.

Creating the button via a client script seems easy enough, but how do I create a custom dialog?

Try:
frappe.new_doc('Communication', {'fieldname': 'prefilled-value'});

That doesn’t seem to work…

Even though I enabled “Quick Entry” for the “Subject Field” (which is Mandatory), it doesn’t appear in the form from the Custom Script button.

If I click on “Edit Full Form” it doesn’t give me the option to save the Communication.

You can create custom Dialogs that are triggered by custom buttons.

Here’s some of the official documentation about that:
Dialog API

If you’re looking for an example, here’s some ERPNext code that adds a button and Dialog to the Customer DocType.

https://github.com/frappe/erpnext/blob/develop/erpnext/selling/doctype/customer/customer.js#L203

For more examples, do a global text search for frappe.ui.Dialog. There are a ton of examples in both Frappe and ERPNext repositories.