Sha256: bf1a492b194006ea893632437e565f1cf4b724db5ee2ff53f4cae938d1a60411

Contents?: true

Size: 1.95 KB

Versions: 17

Compression:

Stored size: 1.95 KB

Contents

module NetSuite
  module Records
    class CustomRecord
      include Support::Fields
      include Support::RecordRefs
      include Support::Records
      include Support::Actions
      include Namespaces::SetupCustom

      actions :get, :add, :delete

      fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
        :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
        :is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
        :numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix,
        :record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified_on_list,
        :show_last_modified, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions

      field :custom_field_list, CustomFieldList

      record_refs :custom_form, :owner, :rec_type

      attr_reader :internal_id
      attr_accessor :external_id

      def initialize(attributes = {})
        @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
        @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
        initialize_from_attributes_hash(attributes)
      end

      def self.get(options = {})
        options.merge!(:type_id => type_id) unless options[:type_id]
        super(options.merge(:custom => true))
      end

      def delete
        super(:custom => true)
      end

      def self.type_id(id = nil)
        if id
          @type_id = id
        else
          @type_id
        end
      end

      def record_type
        "#{record_namespace}:CustomRecord"
      end

      def to_record
        rec = super
        rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
        rec
      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
netsuite-0.0.50 lib/netsuite/records/custom_record.rb
netsuite-0.0.49 lib/netsuite/records/custom_record.rb
netsuite-0.0.48 lib/netsuite/records/custom_record.rb
netsuite-0.0.47 lib/netsuite/records/custom_record.rb
netsuite-0.0.45 lib/netsuite/records/custom_record.rb
netsuite-0.0.44 lib/netsuite/records/custom_record.rb
netsuite-0.0.43 lib/netsuite/records/custom_record.rb
netsuite-0.0.42 lib/netsuite/records/custom_record.rb
netsuite-0.0.41 lib/netsuite/records/custom_record.rb
netsuite-0.0.40 lib/netsuite/records/custom_record.rb
netsuite-0.0.39 lib/netsuite/records/custom_record.rb
netsuite-0.0.38 lib/netsuite/records/custom_record.rb
netsuite-0.0.37 lib/netsuite/records/custom_record.rb
netsuite-0.0.36 lib/netsuite/records/custom_record.rb
netsuite-0.0.35 lib/netsuite/records/custom_record.rb
netsuite-0.0.34 lib/netsuite/records/custom_record.rb
netsuite-0.0.33 lib/netsuite/records/custom_record.rb