Try ERPNext Buy Support Partners Foundation

Set default email template for doctype

Is there a way to set the default Email Template for a DocType?

In Print Format i can say "This is the default print format for DocType Quotation". I need the same for Email Templates.


Hi rmeyer,

I did it, but not linked to doctype. I linked it to print format.

I add a custom field to print_format. A link to email_template.

Then I add this .js in public folder of my custom app.

frappe.views.CustomCommunicationComposer = frappe.views.CommunicationComposer.extend({
	prepare: function() {
		// this line add email template to email dialog.		
		this.dialog.fields_dict["email_template"].set_value(frappe.model.get_value("Print Format", this.dialog.fields_dict.select_print_format.get_value(), "email_template"));

		this.dialog.fields_dict.recipients.set_value(this.recipients || ''); || '');
		this.dialog.fields_dict.bcc.set_value(this.bcc || '');

		if(this.dialog.fields_dict.sender) {
			this.dialog.fields_dict.sender.set_value(this.sender || '');
		this.dialog.fields_dict.subject.set_value(this.subject || '');


frappe.views.CommunicationComposer = frappe.views.CustomCommunicationComposer

Don’t forget to add your .js file in build.json.

1 Like


Is this still the way to go?

I never actually used this but we could surely implement it (and contribute it back to frappe).

1 Like

I think this would a realy useful core feature, when one would be able to set a default email template for a doctype…but its sounds more like a job for you, then me :slight_smile: let me know if you have any intentions, i would consider a small bounty for a feature like this.