2. Build the Leave Request SmartObject

In this step, you will create the Leave Request (SmartBox) SmartObject in K2 Designer. This SmartObject will store the leave requests entered by our users.

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).

  1. Begin by adding a new SmartObject to store the leave request records. Create a new SmartBox SmartObject under the SmartObjects category and name it Leave Request SmartObject, then UNCHECK the Legacy Workflow Designer option. You are using the new designer in this tutorial.
    1. Create a new SmartBox SmartObject from K2 Designer to store the leave request records. Right-click the SmartObjects category and select New SmartObject.
      New SmartObject
    2. The SmartObject designer opens on the GENERAL settings screen. Name the new SmartObject
      Leave Request SmartObject
      then confirm the SmartBox option is selected. In a later step, you will learn more about the Advanced option, which connects the SmartObjects to an existing data source. UNCHECK the option to Allow this SmartObject to be used in the Legacy Workflow Designer, then click CREATE. We will not be working with the legacy workflow designer in this tutorial.
      Depending on your K2 installation configuration, you may not see the Allow this SmartObject to be used in the Legacy Workflow Designer option. If you do not see the legacy workflow designer option, it is OK to continue to the next step.
      Name the New SmartBox SmartObject
  2. Next, you will define the properties necessary for the Leave Request SmartObject. Add the remaining Leave Request SmartObject properties using the table below as a guide.
    NameTypeNotes
    IDAutonumberK2 adds the ID automatically and it is the primary (or unique) key for each record.
    Leave Request TitleText 
    Employee NameText 
    Employee EmailText 
    Leave Start DateDate 
    Leave End DateDate 
    Leave TypeText 
    Requester CommentsMemo 
    Request StatusTextThe workflow updates this field.
    1. 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 Leave Request Application.
      Click Add. Enter the property Name and data Type using the table values below the image for reference. Click the <Add property> link to add more properties until you have entered all eight properties, and then click OK.
      Add SmartBox SmartObject Properties
      NameTypeNotes
      IDAutonumberK2 adds the ID automatically and it is the primary (or unique) key for each record.
      Leave Request TitleTextA unique title for each leave request.
      Employee NameTextThe person who is requesting the leave.
      Employee EmailTextThe email of the person requesting the leave.
      Leave Start DateDateWhat date the leave will start on.
      Leave End DateDateWhat date the leave will end on.
      Leave TypeTextThis will store the selected leave type, selected by a drop-down list.
      Requester CommentsMemoTo allow the requester to enter comments.
      Request StatusTextThe workflow updates this field with the status of the leave request as the workflow progresses.
  3. Finish the wizard to publish the SmartObject.

    The Leave Request (SmartBox) SmartObject
    Leave Request SmartObject

    1. Your properties screen should look like the image below. Now you can "finish" the SmartObject. Finishing a SmartObject publishes it to the K2 server and make it available for use in other artifacts, such as views and forms. Click FINISH to publish the new SmartObject to the K2 server.
      Finish the SmartBox SmartObject
Review

In this step, you created the Leave Request (SmartBox) SmartObject. This SmartObject stores the leave request data entered by our users. In the next step, you will create the Leave Request Item View. This is the user interface for entering leave request details.

Next Step: 3. Build the Leave Request Item View