pacx column add string - neronotte/Greg.Xrm.Command GitHub Wiki

Creates a string column.

Aliases

pacx column add text

Usage

It's the type of column created by default if you simply type

pacx column create -t tableName -n columnName

The system will automatically generate a column of type text with the following features:

  • Display Name: columnName
  • Schema Name: publisherprefix_columnName (all lowercase without special chars or spaces)
  • Type: String
  • Format: Text
  • Max Length: 100
  • Required: None
  • Audit Enabled: true

You can manually set all other arguments in the following way:

# Specify a different format (supported values are: Email, Text, TextArea, Url, TickerSymbol, Phone, Json, RichText)
pacx column create -t tableName -n columnName --stringFormat Email

# Specify a different max length (default is 100)
pacx column create -t tableName -n columnName --len 200

# Create a required field (supported values are: None, ApplicationRequired, Recommended)
pacx column create -t tableName -n columnName -r ApplicationRequired

# Disable auditing for this column
pacx column create -t tableName -n columnName --audit false

# Create a column with a description
pacx column create -t tableName -n columnName -d "This is a description of the column"

# Create a column of type TextArea or RichText, required
pacx column create -t tableName -n columnName --stringFormat TextArea --len 2000 -r ApplicationRequired 
pacx column create -t tableName -n columnName --stringFormat RichText --len 2000 -r ApplicationRequired 

# Create a column of type Json
pacx column create -t tableName -n columnName --stringFormat Json --len 4000

If you want to create an autonumber field, you can use the --autoNumber option. The format must be specified in the form of a string, using the same syntax as the one used in the maker portal. For example, you can use {SEQNUM(5)} to create a 5-digit autonumber field.

# Example value: XX-00001
pacx column create -t tableName -n columnName --autonumber "XX-{SEQNUM(5)}"

# Example value: 123456-#-R3V
pacx column create -t tableName -n columnName --autonumber "{SEQNUM:6}-#-{RANDSTRING:3}"

# Example value: CAS-002000-S1P0H0-20170913091544
pacx column create -t tableName -n columnName --autonumber "CAS-{SEQNUM:6}-{RANDSTRING:6}-{DATETIMEUTC:yyyyMMddhhmmss}"

# Example value: CAS-002000-201709-Z8M2Z6-110901
pacx column create -t tableName -n columnName --autonumber "CAS-{SEQNUM:6}-{DATETIMEUTC:yyyyMM}-{RANDSTRING:6}-{DATETIMEUTC:hhmmss}"

Arguments

Long Name Short Name Required? Description Default value Valid values
table t Y The name of the entity for which you want to create an attribute - String
name n Y The display name of the attribute. - String
schemaName sn N The schema name of the attribute. If not specified, is deducted from the display name - String
description d N The description of the attribute. - String
requiredLevel r N The required level of the attribute. - None, SystemRequired, ApplicationRequired, Recommended
format f N The format of the string attribute (default: Text). - Email, Text, TextArea, Url, TickerSymbol, PhoneticGuide, VersionNumber, Phone, Json, RichText
len l N The maximum length for string attribute. 100 Int32
autoNumber an N In case of autonumber field, the autonumber format to apply. - String
audit a N Indicates whether the attribute is enabled for auditing (default: true). - true, false
solution s N The name of the unmanaged solution to which you want to add this attribute. - String