Issue Creation Plugin

Added by Rick Barrette over 10 years ago

I am currently writing a plugin the creates a new issue via a http post request. I am currently Having issues with creating and saving a new issue. I was hoping that someone would point me in the right direction. Thank you in advance

issue =
issue.tracker = Tracker.find_by_name("Bug")
issue.subject = params[:subject]
issue.description = params[:description]
issue.project = Project.find_by_name(params[:project])
issue.start_date ="%Y-%m-%d")
issue.priority = IssuePriority.find_by_name("Normal") = User.find_by_mail("")
issue.status = IssueStatus.find_by_name("New")

Replies (2)

RE: Issue Creation Plugin - Added by Rick Barrette over 10 years ago

After calling `issue.errors.full_messages` , I discovered that I could not save the issue because required custom fields were not set.

I added the following code before calling

issue.custom_values = [
  create_custom_value(CustomField.find_by_name("StackTrace").id, params[:stackTrace]),
  ... more custom values ...

also here is my create_custom_value method

# returns a new custom value
def create_custom_value(field_id, value)
  custom_value =
  custom_value.custom_field_id = field_id
  custom_value.value = value
  custom_value.customized_type = "Issue" 
  return custom_value

RE: Issue Creation Plugin - Added by anish shah almost 9 years ago

i am facing almost same problem any help.....