Parsware
All articles

How-tos

How to add every kind of field

Text, multiline text, whole number, yes/no, date, choice, file and image: add one of each to a table, put them on the form, and fill in a record to see the control each one gets. How-to video H017, step by step.

A bright cover reading "How-to · H017: Add every kind of field", with "And the control each one gets" under it, the steps Save & New → Form → Shell → Record, and two screens from the video.

How-to H017 · 3 min 35 s. A complete tutorial: all eight fields the video adds, with their settings, the control each one gets, and the table's document at the end. Every picture is a frame of the video.

The data type you choose decides the control people get: a calendar, a check box, a coloured drop-down, a picture. In this tutorial you add one field of each common kind to Opportunity, put them all on its form, and fill in a record to see every control.

Before you start

  • The Opportunity table with Name and Estimated value, from How to add a field to a table.

  • A Sales stage option set in Sales Tracker, with four stages. Make it as in How to create an option set:

    Option Colour
    Qualify Slate #64748b
    Develop Blue #2563eb
    Propose Amber #d97706
    Close Green #16a34a
  • A model-driven app called Sales Tracker that shows Opportunity, shared with a role you have. The video made it ahead of time: a navigation group Sales with Opportunity in it, and Opportunity as the home page.

Part 1: Add the eight fields

  1. Open Solutions, then Sales Tracker, select Tables and open Opportunity.
  2. Select New.
  3. Add each field below. After each one, select Save & New: the field is saved and the panel opens again for the next, keeping the data type you just used. For the last one, select Save, which closes the panel.
# Display name Logical name Data type Settings Why this type
1 Contact name tsp_contactname Text Max length: leave the default, 100 One line of text.
2 Description tsp_description Multiline text Anything longer than a line.
3 Probability tsp_probability Integer A whole number, a percentage.
4 Hot lead tsp_hotlead Boolean A yes-or-no question.
5 Close date tsp_closedate Date/time A date.
6 Sales stage tsp_salesstage Option set Option set: Sales stage One value from a fixed list.
7 Proposal tsp_proposal File A document.
8 Customer logo tsp_customerlogo Image Select Save, not Save & New A picture.

Opportunity's fields after a run of Save & New: Close date, Contact name, Description, Estimated value, Hot lead and Probability, with the New field panel set to Date/time.

Check it: the table has ten fields now, each with its own type, and every one already has its column.

Part 2: Put them on the form

None of them is on a form yet.

  1. Select Forms and open Information.
  2. Drag each new field from Available fields into the General section, in the order people should fill them in. The video's order: Contact name, Sales stage, Probability, Close date, Description, Customer logo, Proposal, Hot lead.
  3. Select Save.

Part 3: Fill in a record

  1. Open Sales Test's address, and open the Sales Tracker app.
  2. Select New.
  3. Fill in every control:
Field The control What to do
Name Text box Type Contoso fleet renewal.
Estimated value Number box Type a value.
Contact name Text box Type a name.
Sales stage Coloured drop-down of the stages Pick Propose.
Probability Number box Type 60.
Close date Calendar Pick a day next month, and select Done.
Description A larger box that grows as you type Type a sentence or two.
Customer logo Shows the picture you choose Choose an image file.
Proposal Shows the file's name and size Choose a document, such as a PDF.
Hot lead Check box Tick it.
  1. Select Save.

The image and the file are uploaded when the record saves, not when you choose them. The record keeps every value, and its title is now the opportunity's name.

An opportunity, Contoso fleet renewal, filled in: probability 60, a close date, a description, a customer logo, a proposal PDF and Hot lead ticked.

The table as text

After Part 1, Opportunity's document lists all ten fields:

{
  "logicalName": "tsp_opportunity",
  "displayName": "Opportunity",
  "displayCollectionName": "Opportunities",
  "icon": "Handshake",
  "publisherPrefix": "tsp",
  "primaryField": "tsp_name",
  "fields": [
    { "logicalName": "tsp_name", "displayName": "Name", "dataType": "Text", "isRequired": true, "isPrimary": true },
    { "logicalName": "tsp_estimatedvalue", "displayName": "Estimated value", "dataType": "Decimal", "precision": 18, "scale": 2 },
    { "logicalName": "tsp_contactname", "displayName": "Contact name", "dataType": "Text", "maxLength": 100 },
    { "logicalName": "tsp_description", "displayName": "Description", "dataType": "MultilineText" },
    { "logicalName": "tsp_probability", "displayName": "Probability", "dataType": "Integer" },
    { "logicalName": "tsp_hotlead", "displayName": "Hot lead", "dataType": "Boolean" },
    { "logicalName": "tsp_closedate", "displayName": "Close date", "dataType": "DateTime" },
    { "logicalName": "tsp_salesstage", "displayName": "Sales stage", "dataType": "OptionSet", "optionSet": "tsp_salesstage" },
    { "logicalName": "tsp_proposal", "displayName": "Proposal", "dataType": "File" },
    { "logicalName": "tsp_customerlogo", "displayName": "Customer logo", "dataType": "Image" }
  ]
}

An option-set field names its set by logical name, not by an id, so the link survives an export and import into another environment.

The same record, created from a script instead of the form, gives each type its own kind of value:

createRecord("tsp_opportunity", {
  tsp_name: "Northwind renewal",
  tsp_contactname: "Grace Turner",
  tsp_probability: 40,
  tsp_hotlead: false,
  tsp_estimatedvalue: 12500.00
});

Text in quotes, numbers without, Booleans as true or false. An option-set field takes the option's number, which you see on the option set after it is saved.

If something goes wrong

  • Sales stage isn't offered under Option set. The set has to exist first, in the same environment. Make it, then add the field.
  • A field isn't on the record in the app. It isn't on the form (Part 2).
  • The picture or the file is missing after you leave. They upload when the record saves. Select Save before leaving the record.
  • Save & New kept the wrong data type. It keeps the last one on purpose, for a run of fields of one kind. Check Data type before each save.

What you built

A record showing every common control the platform has for a field, and a table you can come back to when choosing a type for a real one.

Read more

Is there a task you would like to see done step by step? Tell us. parsware.com/contact