Changing Subject Value programmatically

Hi I would like to ask if possible to change the value of Subject in Email Notification programmatically. I want to create a Subject with condition depending on the approval_state.

If possible to change the subject input text into script textarea.

Thank you in advance

1 Like

frappe.sendmail() function has a subject parameter. You can pass your subject through that.

Hi Madam,

What .py file can i use that? I want to change the subject programmatically in Notification.

Thank you Madam @pateljannat

In notification.py there is a function send_an_email. Here you will find frappe.sendmail. Add your conditions here.

last question madam after i updated the notification.py is there a building process of this to reflect my changes in the system?

Thank you again madam @pateljannat

To make it reflect in the system, add the conditions in the validate function and save it as self.subject. This same self.subject will get picked by the send_an_email function.

@pateljannat no need for bench buiild madam?

No, this will work for any future notifications that you create.

Hi Madam,

In this function i will try to create conditions?

image

Thank you

yes right