This post is one of a series I am creating aimed at helping people prepare for the MB2-716 certification. (Microsoft Dynamics 365 Customization and Configuration)
In this post I am going to look at fields. A subject which hopefully follows on nicely from my last post about entities. As, after you have created an entity logically the next thing you’d want to do is create the fields which makeup the entity.
Fields are sometimes described as attributes, the two terms are interchangeable.
- Fields are used to store values of defined types. (For example a piece of text or a date.)
- Sometimes fields of the same type can have different formats. (For example, a text field can be optionally formatted as an email address, URL, phone number etc.)
- Fields appear as controls on forms. (Such as a text box, date picker, radio buttons etc.)
- Fields can also be shown in user and system views and can be used as part of queries. (Advanced Finds.)
- For each field a column is created in the SQL table for the entity.
- Fields can be “simple” or calculated.
- Fields can be created that contain rolled up values from related entities.
As mentioned in my post on entities, we have system and custom entities. The system entities will comprise of many out of the box fields but we can add more custom fields as required. Although it is always a good idea to check a suitable system field doesn’t already exist before creating a custom one.
When a custom entity is first created some fields will get created by default. Including things like the primary field, created on, created by, owner and many more. I doubt you will need to know exactly what these fields are but even so it is worth creating a custom entity and before adding your own custom fields have a look. Below you can see that I have done just that. With a “basic” user / team owned entity I have 19 fields before I start adding any custom ones. Notice that only two are prefixed new_. I have used the default publisher which adds new_ to all custom fields. The two fields that are created are name (the primary field for this entity) and id. (Which holds the GUID which is the primary key.)
As mentioned that are essentially three types of fields, simple, calculated and rollup fields.
- Simple, these are “normal” fields that contain data not based on any formula. Examples include test, option sets, whole numbers etc.
- Calculated, contain calculations to derive their content. (Calculated from other fields on the current or related parent entities.)
- Rollup, these fields contain a aggerated value computed from the related records.
Each type of field will have a data type. You may need to know which data types can be applied to which field types. See table below
|Field Type||Data Types|
|Simple||Single Line of Text
Floating Point Number
Multiple Lines of Text
Date and Time
|Calculated||Single Line of Text
Date and Time
Date and Time
Below you will find a table which gives a detailed definition for each data type;
|Field data type||Description|
|Single Line of Text||Up to 4000 characters of text. You can set a maximum length less than 4000! This field has several format options that will change the presentation of the text. Including
|Multiple Lines of Text||Up to 1,048,576 characters of text. You can set a maximum length. When you add this field to the form you can specify the size of the field.
|Option Set||This field provides a set of options. Each option has a number value and label. When added to a form this field uses a “select control” and only one option can be “picked”. When displayed in Advanced Find, you can use a picklist control to select multiple options to include in your search criteria.
Option sets can be defined exist once on an entity. Or alternatively we can define global option sets which are lists of options that can be reused.
|Two Options||This field provides two options. Each option has a number value of 0 or 1 corresponding to a false or true value. Each option also has a label so that true or false values can be represented as “Yes” and “No”, “Hot” and “Cold”, “On” and “Off” or any pair of labels you want to display.
Two option fields don’t provide format options at the field level. But when you add one to the form you can choose to display them as radio buttons, a check box, or a select list.
|Status||A system field that has options that generally correspond to active and inactive status. Some system attributes have additional options, but all custom attributes have only Active and Inactive status options. You can also include custom state transitions to control which status options are available for certain entities.|
|Status Reason||A system field that has options that provide additional detail about the Status field. Each option is associated with one of the available Status options. You can add and edit the options.|
|Whole Number||Integers with a value between -2,147,483,648 and 2,147,483,647 can be in this field. You can restrict the maximum or minimum values in this range. This field has format options None, Duration, Time Zone, and Language that change depending on how the field is presented.
None – Simply displays a number.
Duration – Stores number of minutes in the database but can be displayed as x minutes, hours or days.
Time zone – Each time zone is stored as a number. (e.g. “(GMT-08:00) Pacific Time (US & Canada)”, TimeZoneCode is 4.)
Language – Each language provisioned is held as a four or five digit number.
|Floating Point Number||Up to 5 decimal points of precision can be used for values between -100,000,000,000 and -100,000,000,000 can be in this field. You can specify the level of precision and the maximum and minimum values.
|Decimal Number||Up to 10 decimal points of precision can be used for values between -100,000,000,000 and -100,000,000,000 can be in this field. You can specify the level of precision and the maximum and minimum values.
|Currency||Monetary values between -922,337,203,685,477 and 922,337,203,685,477 can be in this field. You can set a level of precision or choose to base the precision on a specific currency or a single standard precision used by the organization.
|Date and Time||This field has format options to display Date Only or Date and Time.
|Image||Each entity that supports images can have one image field. When an entity has an image field, it can be configured to display the image for the record in the application.|
|Lookup||A field that allows setting a reference to a single record of a specific type of entity. Some system lookup fields behave differently.
|Owner||A system lookup field that references the user or team that is assigned a user or team owned entity record.|
|Unique Identifier||A system field stores a globally unique identifier (GUID) value for each record. Also known as an ID field.|
|Customer||A lookup field that you can use to specify a customer, which can be an account or contact.
The customer field is document here.
Creating / Maintaining Fields
When we create a field the screen looks like this;
The table below covers the detail of each field, as always I strongly recommend you experiment with creating different types of fields;
|Field Requirement||Three options exist;
|Searchable||Yes/no field. Entering no here means the field will not show as a filter field in advanced find.|
|Field Security||Fields that are available for field security will need to be enabled here. Not forgetting a Field Security profile will need to also be defined.|
|Auditing||Setting this field to enabled will enable auditing on this field. (Assuming auditing is also enabled for the organisation and entity.)
For the exam it is worth being aware that auditing needs to be enabled at an organization, entity and field level.
|Description||A multi-line description of the field. This information will show as a “tip” when you hover the mouse over the field name in a form.|
|Appears in global filter in interactive experience||This option only applies if the entity is enabled for use in the Interactive service hub(ISH). With the ISH you can filter dashboards globally by one field from an entity. For example, you might wish to be able to filter cases by the date they were created.|
|Sortable in interactive experience dashboard||This option only applies if the entity is enabled for use in the Interactive service hub(ISH). Like the global filter this defines how data will be sorted within the ISH. For example, cases may commonly be sorted by their modified on date.|
|Data Type||As already mentioned each field will have a data type. This can’t be changed once created. Data types include Single Line of Text, DateTime, OptionSet etc.|
|Field Type||Can be simple (the default) or calculated. If calculated, you will need to save the new field and then the criteria for calculation can be defined.
Note: I will cover calculated and rolled up fields in greater detail in a later post.
|Format||Some fields types can have different formats. For example, a date field can be displayed as date time or just date.
Regardless of the format the underlying data is always stored in a common format.
|Maximum length||Some fields, such as text boxes can have their length controlled.|
|IME Mode||IME mode is used to enable entry of complex characters and symbols, such as Japanese Kanji characters.
Options include Auto (the default), Inactive, Active and Disabled.
|Precision||For some numeric value types, include currency, float and decimal the precision can be defined.
Note: For currency the default precision is “Currency Prevision” meaning the system default would be used.
|Minimum and Maximum value||Some numeric values will have a max and min value. Currency fields, for example can theoretically have a range from -922,337,203,685,477.0000 to 922,337,203,685,477.0000. You may change this to limit the valid values.
For example, if you had a currency value to hold someone’s salary the min value might be 0. (People tend to not earn less than nothing!) and the max might be 1,000,000. (I don’t know many people that earn more than this, although I guess they exist!)
|OPTION SETS||If you select the field type as being an option set several additional “options” become available. Including giving the ability to select a global option set or define option values specific to this field. Plus, you can select a default value.
FYI : I will cover option sets in greater detail in a future post.
|TWO OPTIONS||Two options data types show fields to allow you to define the two possible options and the default. Initially the options will show as No and Yes. But could be changes to “Approved/Unapproved”, “True/False” or anything.
In background a two option field always has a numeric value to 0 or 1.
|Behaviour (Date and Time)||For date time files you can select a behaviour. Options include “Use Local”, “Date Only” and “Time-Zone Independent”.
When the behaviour of a field is “User Local,” field values are displayed in the user’s local time.
When the behaviour of a field is “Date Only,” field values are displayed with no time zone conversion. The date portion of the value is stored and retrieved as specified in the UI and SDK. The time portion of the value will always be 12:00 A.M. The behaviour of this field can’t be changed once it’s saved. (Tip:
When the behaviour of a field is “Time-Zone Independent,” field values are displayed with no time zone conversion. The date and time values are stored and retrieved as specified in the UI and SDK. The behaviour of this field can’t be changed once it’s saved.
|LOOKUP and Customer||If the data type is a lookup you can enter the target record type and relationship name.
The relationship name will be defaulted but you can change if required.
Customer works in a similar manner to lookup but two relationship names are given, one for account and one for contact.
When we create a lookup field a relationship between the current entity and the lookup entity is automatically created. Making the process of creating a relationship for a lookup really simple.
I have covered a lot of detail in these revision notes! Taking time to get some hands on experience of creating fields is really important.
Despite covering a lot of detail about field there is more to come! In future posts I will expand on the details here to cover calculated fields, rolled up field, option sets etc etc.
I hope this post will have helped anyone preparing for the MB2-716 certification.