2. Create the Contact SmartObject

In this step you will create the Contact (SmartBox) SmartObject in K2 Designer. This SmartObject stores the "parent" or "header"information for each contact, and contains properties such as name, phone numbers, and a contact photo. (In a subsequent step, you will create the second SmartBox SmartObject for storing notes and attachments).

SmartBox SmartObjects are K2-provided and managed storage where K2 creates a new table on your behalf in the K2 database. You add properties (think columns in a table) and methods (think create, save, delete). You can associate one SmartObject with another, creating a JOIN type of relationship between data sources.

  1. Begin by adding a data source to store the header information. Create a new SmartBox SmartObject under the SmartObjects category and name it Contact SmartObject then UNCHECK the option to Allow this SmartObject to be used in the Legacy Workflow Designer (if it is checked by default). Since you will not build a workflow in this application, this option is unnecessary.
    Depending on your K2 installation configuration, you may or may not see the Allow this SmartObject to be used in Legacy Workflow Designer option. If you do not see this setting, it is OK to continue to the next step.
    1. Begin by adding a new data source to store the header content for the contact records. In K2 Designer, right-click the SmartObjects category and select New SmartObject.
    2. The SmartObject designer opens on the GENERAL settings screen. Name the SmartObject
      Contact SmartObject
      then confirm the SmartBox option is selected. The Allow this SmartObject to be used in Workflows setting should be UNCHECKED. (This tutorial does not include a workflow component, so this option is not needed.) Click CREATE.
      Depending on your K2 installation configuration, you may or may not see the Allow this SmartObject to be used in Legacy Workflow Designer option. If you do not see this setting, it is OK to continue to the next step.
      Create the Contacts SmartObject
  2. Next, define the properties necessary for the Contact Management application. Add SmartObject properties and their data types using the table below for reference. Click FINISH to save the SmartObject.
    NameData Type Notes
    IDAutonumberK2 adds the ID automatically and it is the primary (or unique) key for each record.
    First NameText
    Last NameText
    RelationshipText
    AddressText
    Home PhoneText
    Work PhoneText
    Mobile PhoneText
    EmailText
    PhotoImage

    On the properties screen, notice that K2 added the ID property for you, which is the primary (or unique) key for each SmartObject record. In this step, you will add the remaining properties for the Contact Management SmartObject. (In a later step, you will design a view from this SmartObject where K2 generates controls and labels based on the properties you have defined).
    Add Properties SmartObject

    1. Now add another property. Click Add. Enter the property Name and data Type using the table below the image for reference. Click the <Add property> link to add more properties until you have entered all nine. Click OK.Contact SmartObject Properties
      NameData TypeNotes
      IDAutonumberK2 adds the ID automatically and it is the primary (or unique) key for each record.
      First NameText
      Last NameText
      RelationshipText
      AddressText
      Home PhoneText
      Work PhoneText
      Mobile PhoneText
      EmailText
      PhotoImage
    2. When complete, the Contact SmartObject should look like the image below.
      Contact SmartObject

    3. Finish the SmartObject. The FINISH button is in the upper right corner of the screen. Finishing a SmartObject publishes it to the K2 server and makes it available for use in applications.
      Finishing a SmartObject
Review

In this step, you created the Contact (SmartBox) SmartObject. This SmartObject stores the "header" content for each contact. In the next step, you will create the Contact Notes and Attachments (SmartBox) SmartObject, which stores the "details" content for each record.

Next Step: 3. Create the Contact Notes and Attachments SmartObject