W
W
WordPress WooCommerce2017-06-23 18:24:14
Redmine
WordPress WooCommerce, 2017-06-23 18:24:14

How to programmatically create a task with a parent and get around the error Validation failed: Parent task is invalid?

Hello redmine experts!
I need fire support from the air with wise advice :)
I hung myself on the hook for adding a task and I want to create a subtask in another project.
In general, everything is ok. Except that I can not find a method of specifying the parent in any way.
I get an error: Validation failed: Parent task is invalid
The code is something like this:

# New mechanic
        issue = Issue.new(
          :author => @author,
          :project => Project.find(@project_id_new_pc),
          :tracker => Tracker.find(1),
          :status => IssueStatus.find(1)
        )
        issue.subject = @subject
        issue.parent_issue_id = @id
        issue.save!

If you remove issue.parent_issue_id = @id, then everything works with a bang. I return and get the above error.
Tell me what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question