Project

General

Profile

Creating subtask if the issue's status has changed

Added by nadia nadia almost 8 years ago

Hello all,

I already tried to create subtask when issue's status has changed using the following source code but i didn't work.

# = before_save = #
@need_create = status_id_changed? && !new_record?
# = after_save = #
if @need_create
  issue = Issue.create!(
    :author => User.current,
    :project => project,
    :tracker => tracker,
    :assigned_to => author,
    :parent_issue_id => id,
    :subject => "Subtask",
    :description => "Description")
end

Any help please.