Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Email Dialog Error | Customisation | Version 13

Hi , I was trying to code a button to send e-mails. I borrowed the below code from communication.js and running it on console gives the screenshot below.
Code : (run in console)

new frappe.views.CommunicationComposer({
		subject: 'Ping',
		recipients: "support@metadrex.in",
		message: "Hi ya doin",
		doc: {
			doctype: "User",
			name: frappe.session.user
		}
	})

Result:

But when i click send i get the below error on console.

communication.js:607 Uncaught TypeError: Cannot read property 'doctype' of undefined
at init.delete_saved_draft (communication.js:607)
at frappe.ui.Dialog.primary_action (communication.js:23)
at HTMLButtonElement.<anonymous> (dialog.js:149)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.r.handle (jquery.min.js:3)

I am not able to debug this error, any pointers?

1 Like

aaand its working like a charm.

I am very new to ERPNext and coding. Could you share how you identified the error.
i saw line communication.js:607 but wasn’t able to figure it out.