Project

General

Profile

How to create a Project Custom Field?

Added by Lenny Basuino over 11 years ago

I'd like to add the creation of a Project Custom Field to a plugin. I suppose one way would be to add it to a migration script. Where can I find the syntax for this? Specifically how to create a custom field on a project as a list type with the list populated?
TIA!


Replies (1)

RE: How to create a Project Custom Field? - Added by Lenny Basuino over 11 years ago

This worked!

class PopulateCustomFields < ActiveRecord::Migration
def self.up
ProjectCustomField.create(:name => 'Estimated time units'; :field_format => 'list', :possible_values => ['Hours', 'Points'], :default_value => 'Hours', :is_required => true, :editable => true, :visible => true)
end

    (1-1/1)