Sie sind auf Seite 1von 88

K2 Development Lab Exercise

1

Contents
Lab 1: MC Form Submission and Approval ......................................................................................................................... 1
1.1 Start K2 Designer ..................................................................................................................................................... 5
1.2 Create Working Category for Lab 1 .......................................................................................................................... 5
1.3 Create SmartObject ................................................................................................................................................. 7
1.3.1 Create MC Application Submission SmartObject .............................................................................................. 7
1.3.2 Create MC Approval SmartObject ................................................................................................................... 10
1.4 Create Views .......................................................................................................................................................... 12
1.4.1 Create MC Application Submission Detail View .............................................................................................. 12
1.4.2 Create MC Approving Officer View .................................................................................................................. 18
1.4.3 Create MC Application Read Only View .......................................................................................................... 19
1.4.4 Create a MC Approval List View ...................................................................................................................... 22
1.5 Create Forms ......................................................................................................................................................... 24
1.5.1 Create MC Application Submission Form ........................................................................................................ 24
1.5.2 Create MC Approval Submission Form ........................................................................................................... 34
1.6 Create Workflow ..................................................................................................................................................... 42
1.6.1 Create MC Application Submission Workflow .................................................................................................. 42
Lab 2 - Master-Details Form ................................................................................................................................................ 57
2.1 Create Working Category for Lab 2 ........................................................................................................................ 58
2.2 Create SmartObjects .............................................................................................................................................. 59
2.2.1 Create Master SmartObject ............................................................................................................................. 59
2.2.2 Create Details SmartObject ............................................................................................................................. 61
2.3 Create Views .......................................................................................................................................................... 62
2

2.3.1 Create Master View ......................................................................................................................................... 62
2.3.2 Create Details View ......................................................................................................................................... 65
2.4 Create Form ........................................................................................................................................................... 67
2.5 Test Form ............................................................................................................................................................... 74
Lab 3: Retrieve data from Enterprise Database via SmartObject ........................................................................................ 77
3.1 Create Working Category for Lab 3 ........................................................................................................................ 77
3.2 Create View............................................................................................................................................................ 78
3.2.1 Create Staff Details View ................................................................................................................................. 78
3.3 Create Form ........................................................................................................................................................... 85


1

Lab 1: MC Form Submission and Approval

Objective
In this lab, you will create a basic workflow application that comprises essential components; SmartObjects, Views, Forms
and Workflow.
General development flow when creating a K2 workflow application.


Duration
This lab should take around 1hr to complete. There are 5 parts to this lab exercise:
1. Create 2 SmartObjects
MC Application Details - [SOMCApplicantSubmissionData]
MC Approval Details - [SOMCApprovalSubmissionData]

2. Create 4 Views
Applicant View (for application, editable) - [ViewMCApplicantSubmissionDetail]
Applicant View (for approval, read only) - [ViewMCApplicantSubmissionDisplay]
Approver View (for approver, editable) - [ViewMCApprovalSubmission]
Summary View (list of applications received) - [ViewMCApprovalSubmissionList]

SmartObjects Views Forms Workflow
2

3. Create 2 Forms
Application Form (with 1 Submit button) - [FormMCAppSub]



ViewMCApplicantSubmissionDetail
For applicant, editable
3

Approver Form (with a dropdown and a Submit button) - [FormMCApprovalSub]



ViewMCApplicantSubmissionDisplay
- For approval view, display only
ViewMCApprovalSubmission
For approver, editable.
ViewMCApprovalSubmissionList
For approver summary view
4

4. Create 1 Workflow
One level of approval, accept or reject - [Workflow]



5

1.1 Start K2 Designer

Start K2 Designer in your browser with the following URL with your network account:
http://n4apdev0092:81/designer (for CITS developers) or
http://n4apdev0093:81/designer (for Schools developers)

1.2 Create Working Category for Lab 1

Step 1 Expand All Items node to locate \K2 Training\Session N category (N denotes your assigned training
session)

Step 2 Right-click All Items\K2 Training\Session N category and select New Category.


Update the following information:
- Name: XXX (XXX denotes your initial),
- Description: Project folder for XXX (optional)
- Click OK

6

Step 3 Right-click All Items\K2 Training\Session N\XXX category and select New Category.
Update the following information:
- Name: Lab 1
- Description: Lab 1 (optional)
- Click OK

You working category for this lab is All Items\K2 Training\Session N\XXX\Lab 1 (N denotes your
assigned training session, XXX denotes your initial)

7

1.3 Create SmartObject
Two SmartObjects are required in the solution:
MC Application Submission
MC Approval

These SmartObjects are created using the K2 Designer and since the data for the objects does not exist yet, will be
created as K2 SmartBox SmartObjects. They will be used to create views.

1.3.1 Create MC Application Submission SmartObject
Step 1

















Right-click working category, select New SmartObject
Click Next
Update the following information:
- Name: XXX_SOMCSubmission (XXX denotes your initial)
- Description: This SmartObject stores MC Application Submission details
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
Choose Type: SmartObject


8



Click Next
Step 2 Add the following fields:

Property Name Description Type Key Required
*ID Primary key of the
application
Autonumber Yes
StaffID Applicant ID Text Yes
Name Applicant Name Text Yes
MCType MC Type Text Yes
DateFrom MC Start Date Date/Time Yes
DateTo MC End Date Date/Time Yes
Attachment Scanned copy of the
MC
File
Remarks Applicants remark Memo
ApproverName Approvers Name Text Yes
ApproverEmail Approvers Email

Text Yes

*Note - ID is system generated. No need to manually create.

9

End Result




10

1.3.2 Create MC Approval SmartObject
Step 1 Right-click your working category, select New SmartObject
Click Next
Update the following information:
- Name: XXX_SOMCApproval (XXX denotes your initial)
- Description: This SmartObject stores the approvers details
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
Choose Type: SmartObject

Step 2









Add the following fields:

Property Name Description Type Key Req
uired
*ID Primary key of the
application
Autonumber Yes
AppID Key Reference from
SOMCSubmision.ID
number Yes
ApproverName Approver Name Text Yes
ActionDt Approver Action Dt Date/Time Yes
Decision Approver Decision Text Yes
Remarks Approvers remark Memo


*Note ID is system generated. No need to manually create.

11

End
Result


12

1.4 Create Views

Four views are required to create the solution:
Applicant View (for application, editable) - [ViewMCApplicantSubmissionDetail]
Applicant View (for approval, read only) - [ViewMCApplicantSubmissionDisplay]
Approver View (for approver, editable) - [ViewMCApprovalSubmission]
Summary View (list of applications received) - [ViewMCApprovalSubmissionList]
These views will be used to create the Forms.

1.4.1 Create MC Application Submission Detail View
Step 1 Right-click SmartObject: XXX_SOMCSubmission.
Select Design View, click Next
Update the following information on View Designer > General screen
Name: XXX_ ViewApplicantC (XXX denotes your initial)
Description: This view is for applicant to update medical claim submission details
Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
View Type: Item View
Data Source: K2 Training\Session N\XXX\Lab 1\XXX_SOMCSubmission
Click Next to proceed

13


Step 2 On View Designer > Layout screen, select Create Labels and Controls
On Create Labels and Controls screen, specify the following:
Table Columns: 2
Label Label Position: Left.
Layout Configure the field (Include, Display Only) as follows:
- StaffID Include, Display only
- Name Include, Display only
- MC Type - Include
- DateFrom Include
- DateTo Include
- Attachment Include
- ApproverName Include
- ApproverEmail Include
- Remarks - Include


14




Click OK
15

Step 3 Change MC Type control from Text to Drop-Down-List (DDL):

- Select the MC Type and click Change Control icon


- Select Drop-Down-List from Change Control dialog box
- Click OK
- In Data Source section, set Type: Static.



Add List items:
Outpatient
Hospitalisation
Misc

16



Click OK to close Fixed List Configuration dialog box
Click OK to close Configure Data Source dialog box
Click Finish to save view

End Result

17



18

1.4.2 Create MC Approving Officer View
Step 1 Right-click SmartObject: XXX_SOMCApproval.
Select Design View, click Next
Update the following information on View Designer > General screen
Name: XXX_ViewApplicationAO (XXX denotes your initial)
Description: Displays approving officers details
Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session number;
XXX denotes your initial)
View Type: Item View
Data Source: K2 Training\Session N\XXX\Lab 1\XXX_SOMCApproval
Click Next to proceed

Step 2 On View Designer > Layout screen, select Create Labels and Controls
On Create Labels and Controls screen, specify the following:
- Table Columns: 2
- Label Label Position: Left.
- Layout - Configure the fields as below:
- Approver Name Include, Display only
- Action Dt Include, Display only
- Decision - Include
- Remarks Include

Click OK

Step 3 Change Decision control from Text to Drop-Down-List (DDL):

Select the Decision and click Change Control icon


Select Drop-Down-List from Change Control dialog box
Click OK
19

Click Finish to save view

End Result


1.4.3 Create MC Application Read Only View
Step 1 - Right-click SmartObject: XXX_SOMCSubmission.
- Select Design View, click Next
- Update the following information on View Designer > General screen
- Name: XXX_ViewApplicantDetailDisplay (XXX denotes your initial)
- Description: This view is for approving officer to view the application details
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
- View Type: Item View
- Data Source: K2 Training\Session N\XXX\Lab 1\XXX_SOMCSubmission
- Click Next to proceed

Step 2 On View Designer > Layout screen, choose Create Labels and Controls
On Create Labels and Controls screen, specify the following:
- Table Columns value: 2
- Label Label Position: Left.
- Layout - Configure all fields to Include and Display Only
20

Click OK



Click Finish to save view

21

End Result




22

1.4.4 Create a MC Approval List View
Step 1 Right-click SmartObject: XXX_SOMCApproval.
Select Design View, click Next
Update the following information on View Designer > General screen
- Name: XXX_ViewApprovalList (XXX denotes your initial)
- Description: This view displays MC application Approval summary
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
- View Type: List View
- Data Source: K2 Training\Session N\XXX\Lab 1\XXX_SOMCApproval
Click Next to proceed

Step 2 On View Designer > Layout screen, choose Create Labels and Controls
On Create Labels and Controls screen, specify the following:
- Layout - Configure the layout to include all fields.
-


Click OK
Click Finish to save view

23

End Result



24

1.5 Create Forms
1.5.1 Create MC Application Submission Form

Step 1 Right-click your working category, select New Form
Click Next
Update the following information on Form Designer > General screen
- Name: XXX_FormMCApplicationSub (where XXX denotes your own initial)
- Description: MC application submission form
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)


Click Next

Step 2 To add views to the Form locate the required view in the category tree and drag and drop it onto the
Form Layout.

Locate the ViewMCSubmissionDetail [XXX_ ViewApplicantC] and drag and drop it onto the Form
Layout.

Select Controls tab under the Toolbox menu and drag two buttons into the blank column below the
view and change name as following : Submit, Clear

25



Click Next to Form Designer > Parameter screen

Click Next to Form Designer > Rules screen


Step 3 a) Configuring the Form rules on Form initialized event: Double Click on the existing rule: When the
Form is initialized.

26




b) On Rules wizard configuration screen, you should see some rules that were automatically created.




c) Add a new rule for retrieving the login user staff detail inside the Initialized event

d) Click on the Actions option on the toolbar to configure actions related to retrieve staff detail. Select
Execute a SmartObject method located under the category SmartObject Interaction.

27




e) In the Rule Definition pane click on the green Select SmartObject and choose StaffSO from path:
lI Items/NTU/BPMS/SmartObjects/StaffSO

Click OK


28



f) On Rule Definition pane click Select Method and choose method Retrieve Staff details By
Network Id as shown below



g) On Rule Definition pane, click (configure)




h) On the configuration screen (below), drag and drop Name from System Context Browser -> System
Values >Current User ->Name into the LanID input textbox

29



i) Click Next button and you shall see the below:





j) Click Next again


k) Drag and drop StaffNo into field StaffID Data Label input textbox and Name into field Name Data
30

Label and click Finish.



l) On Rules Wizard Configuration screen, click Finish


31





Step 4: a) Configuring new Form rules for Submit button action: Click on the Add Rule button.





b) Locate the Form Events and select When a control on the Form raises an event.



32


c) Select select control and Choose Submit button. Then click on the Actions tab and select
Execute a View method.

It will appear with View Name or click select view to choose the view.. Click select method and
choose Create method follows by (configure)



d) Drag and drop the related input controls into input properties text area and click Finish

33


e) Click Finish on Rule Wizard Configuration screen

Step 5: Click Finish to save form.


34

1.5.2 Create MC Approval Submission Form

Step 1 Right-click your category, select New Form
Click Next
Update the following information on Form Designer > General screen
- Name: XXX_FormMCApprovalSub (where XXX denotes your own initial)
- Description: This form is for MC application approver decision update
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
Click Next to proceed

Step 2 To add views to the Form locate the required views in the category tree and drag and drop it onto the
Form Layout.

a) Locate the ViewMCApprovalSubmissionList [XXX_ViewApplicantDetailDisplay] and drag and
drop it onto the Form Layout.
b) Locate the ViewMCApprovalSubmission [XXX_ ViewApplicationAO] and drag and drop it onto the
Form Layout.
c) Locate the ViewMCApprovalSubmissionList [XXX_ ViewApprovalList] and drag and drop it onto
the Form Layout.
d) Click on the Controls tab under the Toolbox menu and drag the two buttons into the blank column
below the view and change name as following : Submit, Clear

35



e) Click Next to proceed to Form Designer > Parameter

36




f) Click Next again

Step 3: a) Configuring the Form rules on Form initialized event: Double Click on the existing rule: When the
Form is initialized.



b) Next you will see the rules wizard configuration. You will see some Rules that were automatically
created on the Form.

37




c) You need to add the new rules inside the Initialized event - this is to get login user name [approving
officer] and action date [current date & time] with label controls.

d) Click on the Actions option in the toolbar to configure the actions. Click on Set a View Controls
properties twice..

38




e) In the Rule Definition pane click on the select view and choose ViewMCApprovalSubmission (i.e
XXX_ ViewApplicantAO).
f) Next, click on the select control and choose Approver Name Data Label. Click on Configure:
39

Now drag and drop the login user Name from Context Browser -> System Values -> Current User
-> Display Name into Detail -> Text input prompt.
Click OK






g) In the Rule Definition pane click on another green select view and choose
ViewMCApprovalSubmission, i.e <XXX>_ViewApplicantAO. Next step click on the green select
control and choose Action Dt Data label. Click on the green Configure: Now drag and drop the
Current Date & Time from Context Browser -> System Values -> Current Date -> Current Date &
Time into Detail -> Text input prompt.
Click OK button.


40






h) Click Finish on Rules Wizard Configuration screen.

Step 4:



End Result
Configuring new Form rules for Submit button action: Click Add Rule button [Refer the steps given in
1.5.1 -> Step 4 to add rules for submit button....


Note: For view, XXX_ ViewApplicantAO
:

41


Step 5 Click Finish on Form Designer to complete the form


42

1.6 Create Workflow

The workflow will be built using the K2 Workflow Designer.

Scenario:
When the MC Applicant clicks the Submit button on the MC Application Submission form, the Workflow will kick start and
the Worklist item will then be routed to the Approving Officer for processing. The Approving Officer will open the work item
from email link (or K2 Workspace) and choose either the Approve or Decline to process the application. Upon taking
action, the applicant shall receive an e-mail notification informing him/her whether his/her application was successful or
not.

1.6.1 Create MC Application Submission Workflow

Step 1 Right-click your category, select New Workflow
Click Next
Update the following information on Form Designer > General screen
- Name: XXXWfMCApplicationSub (where XXX is your own initial)
- Description: This workflow is to submit an MC application for approval
- Category: \All Items\K2 Training\Session N\XXX\Lab 1 (N denotes assigned training session
number; XXX denotes your initial)
Click Next to proceed

Step 2 1) Click on the ellipsis next to the Form prompt: field.
2) Expand K2 Training\Session N\XXX\Lab 1 category and select the MC Application Submission
Form (i.e XXX_ FormMCApplicationSub)
3) Click OK.
4) Expand the Form field by clicking on the down arrow next to Form prompt. This will open additional
settings for the Form.
5) Select (Base State) under Use an existing state
6) Uncheck the check box titled Make this State the default for this Form.
7) Expand SmartForms in the Context Browser and browse to XXX_FormMCApplicationSub>
SmartForms > XXX_SOMCSubmission and drag the ID into the folio field.
43

8) At this junction, validate what you entered with follow:


9) Click Next button
10) Add the following data fields:
ID of type Integer
Email of type string


44



11) Click Next
12) On the Configure the rule to start the Workflow screen (Workflow Settings - Start Form), click on
the drop down box and choose the rule: When Submit is Clicked

13) Select the Rule Action called then start the WFApplicationSubmissionA Workflow.


45


14) Click Next
15) On the Start Form screen, expand SmartForms in the Context Browser and browse to XXX_Form
MC Application Submission > XXX_ViewApplicantC>
16) Drag the ID from XXX_SOMCSubmisison -> ID next the ID Data Field prompt. This will map the
value from the Form to the workflow data field.
46


17) Drag the ApproverEmail from Controls>ApprovalEmail textbox next to email textbox



18) Click Next.
19) Click Next.
20) Add Start rights for the user that will be completing the Application Form. This could be domain
users or individual user
21) Check the Start and View Participate checkboxes.


47


22) Click Finish.
23) Drag the User Task from the Workflow Steps tab > General category onto the drop zone on the
canvas.
24) Type MCApproval in the Name field.
25) Type Approved and Declined in the Action pane.



26) Click Next.
27) Click Next.
48

28) Expand the drop down arrow next to the 'Form:' prompt to open out additional Form properties.
29) Select the form MC Approval Submission (i.e XXX_ FormMCApprovalSub) from your working
category.
30) Select Create a new State : SupApproval.



31) Click on the Action Settings button.
32) Click on Use an existing list control to display the actions.
33) Expand SmartForms in the Context Browser and browse to XXX_FormMCApprovalSub >
XXX_ViewApplicationAO>List Controls>
34) Drag and drop the approval dropdown list into Select Control


49



35) Click Next
36) Click Finish then you will see the user task main window

50



37) Click Next then you will see rules configuration window. Automatically all the rules were set as
shown below

51



38) Click Next then you will see participants Add Task Group window
39) Click on Context Browser tab, drag and drop the email from Context Browser> Data Fields> Email
into the Task Group
40) Click checkbox Notify participants when they receive a work item
41) The outcome is as shown below:

52



42) Click Next to see Email Notification settings window
43) Click checkbox Customize the notification Message
44) Input the email subject as:
MC Application ID Reference *<ID> - Submitted for Your Approval

* Note : drag the reference ID from Context Browser> Data Fields>ID.

53


45) Click Finish.






54

46) Drag Send E-mail icon from the Workflow Steps tab onto the Approved flow box Drag or Double-
Click to Configure.
47) Click down-arrow next to the To prompt to see additional prompts.
48) Drag and drop the following fields from the Context Browser window
Data Fields -> Email into CC
Workflow Context ->Originator Email into To
Enter Email Subject as Approved


49) Click OK

50) Repeat above steps for configuring Declined email notification.

55


51) Click File>Save.
52) Click File>Deploy.



Workflow is ready!

56


57

Lab 2 - Master-Details Form

Objective
In this lab, you will create a form comprising 2 views with master-details relationship.
Duration
This lab should take about 20 min to complete. There are 3 parts to this lab exercise:
1. Create 2 SmartObjects
- XXX_SOMaster Master
- XXX_SODetails Details
2. Create 2 Views
- XXX_ ViewMaster - Master View
- XXX_SODetails Details View
3. Create Form
- XXX_Form with Master and Detail views

58

2.1 Create Working Category for Lab 2

Step 1 Expand All Items node to locate \K2 Training\Session N\XXX folder (N denotes your assigned
training session; XXX denotes your initial)

Step 2 Right-click All Items\K2 Training\Session N\XXX category and select New Category.
Update the following information:
- Name: Lab 2
- Description: Project category for Lab 2 (optional)
- Click OK

You working category for this lab is All Items\K2 Training\Session N\XXX\Lab 2 (N denotes your
assigned training session; XXX denotes your initial)


59

2.2 Create SmartObjects
Two SmartObjects are required in the solution:
XXX_SOMaster Master
XXX_SODetails Details

These SmartObjects are created using the K2 Designer and since the data for the objects does not exist yet, will be
created as K2 SmartBox SmartObjects. They will be used to create views.

2.2.1 Create Master SmartObject

Step 1 Right-click your working category, select New SmartObject
Click Next
Update the following information:
- Name: XXX_SOMaster (XXX denotes your initial)
- Description: This SmartObject stores master data
- Category: \All Items\K2 Training\Session N\XXX\Lab 2 (N denotes assigned training session number; XXX
denotes your initial)
Choose Type: SmartObject
Click Next

Step 2 Add the following fields:

Property Name Description Type Key
ID Form
number(Primary
Key)
Autonumber Yes
Name Staff name Text


60

End Result



61

2.2.2 Create Details SmartObject

Step 1 Right-click your working category, select New SmartObject
Click Next
Update the following information:
- Name: XXX_SODetails (XXX denotes your initial)
- Description: This SmartObject stores details data
- Category: \All Items\K2 Training\Session N\XXX\Lab 2 (N denotes assigned training session number; XXX
denotes your initial)
Choose Type: SmartObject
Click Next

Step 2 Add the following fields:


Property Name Description Type Key
ID Primary key of
the application
Autonumber Yes
MasterID Link to master
SO ID
Number
DateFrom Date from Date
DateTo Date To Date


62

End Result

2.3 Create Views

Two views are required to create the solution:
- XXX_ ViewMaster (master, editable)
- XXX_ViewDetails (details, editable)

These views will be used to create the Forms.

2.3.1 Create Master View
Step 1 Right-click SmartObject: XXX_SOMaster.
Select Design View, click Next
Update the following information on View Designer > General screen
Name: XXX_ ViewMaster (XXX denotes your initial)
Description: This view to display master data view
Category: \All Items\K2 Training\Session N\XXX\Lab 2 (N denotes assigned training session
number; XXX denotes your initial)
View Type: Item View
Data Source: K2 Training\Session N\XXX\Lab 2\XXX_SOMaster
Click Next to proceed


Step 2 On View Designer > Layout screen, select Create Labels and Controls
63

On Create Labels and Controls screen, specify the following:
Table Columns: 2
Label Label Position: Left.
Layout Configure the Field (Include, Display Only) as follows:
- Name Include

Click OK
Click Finish to save view
End Result


64


65

2.3.2 Create Details View
Step 1 Right-click SmartObject: XXX_SODetails.
Select Design View, click Next
Update the following information on View Designer > General screen
Name: XXX_ViewDetails (XXX denotes your initial)
Description: This view to display details data view
Category: \All Items\K2 Training\Session N\XXX\Lab 2 (N denotes assigned training session
number; XXX denotes your initial)
View Type: List View
Data Source: K2 Training\Session N\XXX\Lab 2\XXX_SOMaster
Click Next to proceed


Step 2 On View Designer > Layout screen, select Create Labels and Controls
On Create Labels and Controls screen, specify the following:
Edit Option: Enable list Editing
Layout Configure the Field (Include, Display Only) as follows:
- DateFrom Include
- DateTo Include
66



Click OK
Click Finish to save view
67

End Result

2.4 Create Form

Step 1 Right-click your working category, select New Form
Click Next
Update the following information on Form Designer > General screen
- Name: XXX_Form (where XXX denotes your own initial)
- Description: Master-Details Form
- Category: \All Items\K2 Training\Session N\XXX\Lab 2 (N denotes assigned training session number; XXX
denotes your initial)



68

At the Empty Form screen, drag in the Views created in the previous task into the empty form. Add a button
control to your form below the second view and name the button as below. Your screen should look similar to
below:


Step 2 Navigate to Rules. Click on Add Rule.
69



Step 3 You should see the Rules Wizard Configuration window displayed as below.

Locate When a control on the Form raises an event under Form Events and click on it to add the rule. Next
click on Action.


70



Under smartobject interaction, locate Execute a View method and click on it to add the rule. On the same
screen, locate Execute a View method for items that are in a specific state and click to add the rule. Your
configuration screen should look like below:



Click on the select view link and choose the view XXX_ViewMaster.

Next click on select method link and choose create method.

Next click on configure link.








71








At the new screen, mapped the input as shown below.



Click Next button







72











At Output mappings, locate XXX_SODetails smartobject and drag the ID of master view to MasterID as shown
below.



Click Finish button.

You will return to the rules wizards configuration screen again. Now click on the second rule of select view and
choose XXX_ViewDetails view, choose Save method. Click on select item state and choose Added. Click
73

on Configure.

At the Context Browser, expand XXX_ViewMaster. Locate the ID and drag to MasterID field as shown below



Expand XXX_ViewDetails and mapped the rest of the fields as shown below.

74



Click Next then Finish. Click Finish to exit the rules wizard again.
Click Finish to complete the Form design.
2.5 Test Form

Step 1 On K2 Designer, click on XXX_Form. Click on the runtime url link.

75



The form, XXX_Form should load up in a separate window.



Fill in some testing data then proceed to click on the Submit button.

Step 2 Check if the submission is successful completely and all data are saved.

Create to new views for XXX_SOMaster, and XXX_SODetails smartobjects to display all fields (refer
to previous lab where necessary).

Run the 2 generated views and ensure that the ID created in XXX_SOMaster is created and save to
XXX_SODetails as the MasterID field.


76


77

Lab 3: Retrieve data from Enterprise Database via SmartObject

Objective
In this lab, you will create a form that contains a department dropdownlist and a staff list view that displays staff details of
the selected department.
Duration
This lab should take about 15 min to complete. There are 3 parts to this lab exercise:
1. Create - View with dropdownlist and staff list
2. Create Form
3. Test Form

3.1 Create Working Category for Lab 3

Step 1 Expand All Items node to locate \K2 Training\Session N\XXX folder (N denotes your assigned training
session; XXX denotes your initial)

Step 2 Right-click All Items\K2 Training\Session N\XXX category and select New Category.
Update the following information:
- Name: Lab 3
- Description: Project category for Lab 3 (optional)
- Click OK

You working category for this lab is All Items\K2 Training\Session N\XXX\Lab 3 (N denotes your
assigned training session; XXX denotes your initial)

78

3.2 Create View

One view is required to create the solution:
- XXX_ ViewStaffDetails

This views will be used to create the Form.

3.2.1 Create Staff Details View
Step 1 Right-click your working category and select New View.
Click Next
Update the following information on View Designer > General screen
Name: XXX_ ViewStaffDetails (XXX denotes your initial)
Description: This view to staff details (optional)
Category: \All Items\K2 Training\Session N\XXX\Lab 3 (N denotes assigned training session
number; XXX denotes your initial)
View Type: List View
Data Source: \All Items\K2 Training\StaffDetail by Department lab\SOStaffDetails
Click Next to proceed


Step 2 On View Designer > Layout screen, select Create Labels and Controls
On Create Labels and Controls screen, specify the following:
Table Columns: 2
Layout Configure to include all fields - as follows:
79


Click Next

You screen should look like this




80


Step 3 Add a label and dropdownlist controls to the View



Change the label text to Department and rename the Dropdownlist to ddlDept.

Step 4 Select ddlDept and open the Data Source setting under its Properties panel



In the Configure Data Source screen, point the SmartObject to \All Items\K2 Training\StaffDetail by
Department lab\SoDept and configure the Method, Values, Display as below:

81



Click OK

Step 5 Click Next
Click Next
Click on the Rule follow by Add Rule and add rule When a control on the View raises an event
to Rule Definition.

82



Select the control and event for your rule as below:




Step 6 Click Actions and select Execute a method on the View


83



Select method List refresh and leave the configure unchanged.


Click Finish to save the view.

Step 7 Under Rules, select When the View executed Initialize and click Edit Rule.



Double click Rule When the View executed Intialize
84




Click on configure under the execute the List method action
Drag ddlDept under Controls to the properties of ST_DEPT.



Click Finish.



85

3.3 Create Form

Step 1 Create a form from your view, run it and verify that the list view will display the staff
details of the selected department.



Done!

Das könnte Ihnen auch gefallen