Answer the question
In order to leave comments, you need to log in
How to get the issue id & id of the initiator through the ticket creation hook?
redmine has a hook controller_issues_new_after_save - which allows you to catch the issue creation event inside the project.
we write a plugin, we hang ourselves on this hook:
class HelpDeskHooksListener < Redmine::Hook::ViewListener
def controller_issues_new_after_save(context={})
Rails.logger.debug "================================my======================================="
Rails.logger.info context[:issue]
# Rails.logger.info JSON.pretty_generate(context[:issue])
if context[:params][:project_id] == 'test'
@text = Time.now.strftime("%Y-%d-%m %H:%M:%S %Z")
@subject = context[:params][:issue][:subject]
@description = context[:params][:issue][:description]
@body = @text + "\n" + @subject + "\n" + @description
ActionMailer::Base.mail(from: "[email protected]", to: "[email protected]", subject: "test redmine", body: @body).deliver
end
end
end
Answer the question
In order to leave comments, you need to log in
Just like you take params, via context the
initiator is the author?context[:issue].author_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question