Create issue in the new project via Custom WorkFlow plugin

Added by Nikolai Efimov-Soini 12 months ago

Hi!

I want to create an issue when user create new project and select custom field (id=59) by means the Custom WorkFlow plugin. I used the following code:

  1. = before_save = #
    if custom_field_value(59) == "1"
    @need_create = true
    end
  1. = after_save = #

if @need_create

idd = self.project.project_id
issue1 = Issue.new(
:author => User.current,
:project => Project.find(idd),
:tracker_id => 1,
:status_id => 2,
:subject => "1Subtask",
:description => "Description")
issue1.save!

end

Unfortunately, this code doesn't work - I can't find the project. On the other hand, I can create a new issue in the other project(created before), using Project.find("created_project_name").

How I can translate some information (project_id, project identifier, project name etc.) to my new issue? Or maybe I can get this information in the after_save window?