This content is archived. See latest version here.

Last updated: Mar 31 2014

To make it quicker and easier to create meta fields based on system meta types, Business Foundation has a MetaFieldBuilder class, with which you can create meta fields based on existing system meta types.

The following methods are available in the MetaFieldBuilder class:

  • CreateGuid
  • CreateDateTime
  • CreateDate
  • CreateInteger
  • CreateFloat
  • CreateCurrency
  • CreateCheckBoxBoolean
  • CreateDropDownBoolean
  • CreateText CreateEmail
  • CreateUrl CreateLongText
  • CreateHtml
  • CreateFile
  • CreateImage
  • CreateReference
  • CreateReferencedField
  • CreateBackReference
  • CreateCardField
  • CreateEnumField
  • CreateAggregation
  • CreateIntegerPercent
  • CreateFloatPercent
  • CreateDecimalPercent
  • CreateDecimal
  • CreateDuration
When using the MetaFieldBuilder, the Edit scope will automatically be opened.

Creating a meta field with MetaFieldBuilder

Example: Using the MetaFieldBuilder to create a meta field

C#
using (MetaFieldBuilder builder = new MetaFieldBuilder(metaClass))
            {
            builder.CreateDateTime(CreatedFieldName, CreatedFriendlyName, false, true);
            builder.CreateText(CreatorFieldNameText, CreatorFriendlyName, false, 50, false);
            builder.CreateGuid(CreatorFieldNameGuid, CreatorFriendlyName, false);
            builder.CreateInteger(CreatorFieldNameInteger, CreatorFriendlyName, false, -1);
            builder.SaveChanges();
            }

Comments