Send new issue URL to custom email field
Added by Keul Keul almost 13 years ago
Hello,
I've added a custom email field "Send URL issue to" user@example.com
I'm working on a small plugin that use :controller_issues_new_after_save to send the link ot the issue (with id) to the email specified in the custom field.
I've found the plugin NewIssueAlerts (http://www.redmine.org/projects/redmine/wiki/PluginNewIssueAlerts) who send email to emails specified for the current project.
I'd like to chance the code to use email in custom field and not in newissuealert db-table
In /lib/redmine_newissuealerts/issue_patch.rb, I think I should replace:
newissuealerts = Newissuealert.find(:all, :conditions => { :project_id => project.id } ) newissuealerts.each do |n| if n.enabled n.mail_addresses.split(",").each do |e| NewissuealertsMailer.deliver_newissuealert(e, self, n) end end end
with something like
costomfield_value = customfield.find(:all, :conditions => { :name => "Send URL issue to" } ) costomfield_value.each do |n| if self.customfield.[n.custimfield_id] self.customfield.[n.custimfield_id].split(",").each do |e| NewissuealertsMailer.deliver_newissuealert(e, self, n) end end end
But I don't think it's the good way to access custom fields value. Someone know how I could do that?
Replies (2)
RE: Send new issue URL to custom email field - Added by Keul Keul almost 13 years ago
My plugin is nearly finished.
Just one problem : i need to include the full path of the URL in the email, but I don't know how to access to DB.
sql = "SELECT value FROM settings WHERE name='hostname'" host_name_value = ActiveRecord::Base.connection.select_all(sql) host_name_value = host_name_value.inpsect
It returns [] (and should return "ip/path")
RE: Send new issue URL to custom email field - Added by Bhavin Shah over 12 years ago
Hi Keul,
I am writing one plugin for Requirement Traceability Matrix where when i click on Generate RTM button i am fetching data from external server. At that time i have to update some "Link" Custom Field from database and update value for each requirement tracker.
Can you tell me how to access custom field for particular tracker entry and update it?
Thanks,
Bhavin