Use Case of Designing a Service to Select Laptop
The Laptop Selection example uses a grid service item dictionary and a data retrieval rule to demonstrate automatic retrieval of service item data when a field is chosen from a drop-down menu in a grid. The data retrieval rule also includes a Lookup Condition where a data instance is excluded from selection.
This example walks you through the steps.
Step 1 Create New Service Item Group and Service Item, in Service Item Manager > Design Service Items. For detailed procedure or creating group and service item, see Creating a Service Item Group and Creating Service Items.
a. After the new service item is created and as it appears in the Service Item panel on the left under the Group, click Add on the bottom of the page to add the attributes to the Laptops Service Item, as shown below. Each attribute, or row, is a service item instance. The Display Name for each instance will become a column header for the grid.
b. Click Save after adding all attributes
Step 2 Create New Dictionary Group and Grid Dictionary in the Dictionaries component of the Service Designer module. For detailed procedure, see Creating a Dictionary Group andCreating a Dictionary.
a. While creating new dictionary, in the Service Item field of the Add New Internal Dictionary section, enter Laptops to search for the Laptops service item you created, then click Laptops from the popup window that appears, as shown below.
b. In the resultant Dictionary window, enter Laptops for the Dictionary Name and Default Caption fields. The Default Caption will display as the title for the grid. Choose the dictionary group you just created from the Group Name drop-down menu. In the Use and “Show in Grid” columns, check only the five instances of the Laptops service item you created. By checking Use and “Show in Grid”, the instances will appear as columns in the grid. The Name field is already checked by default and cannot be changed.
c. Click Save Dictionary.
Step 3 Create New Form Group and Form.
a. Click the Active Forms Components component of the Service Designer module, and choose New> Form Group. The new form group appears in the Active Form Components tree to the left.
b. Choose New > Active Form Component and enter the required details for the new form and save form.
Step 4 Add Grid Dictionary to Form and Edit Display Properties.
a. Click Add Dictionaries and in the Search field, enter Laptops to search for the Laptops dictionary you created. For the resultant Laptop dictionary, check the Name and “Display as Grid” columns. Checking “Display as Grid” makes the fields of the Laptops dictionary that were checked to “Show in Grid” display as columns in the grid.
b. Click Add to add the Laptops dictionary to the form. The Form Content tab of the Laptop Selection form appears with the Laptops dictionary checked for “Display as Grid”. Note that it is dimmed here and cannot be changed. The only way to change it would be to remove it, and then add it again without checking “Display as Grid”.
c. Click the Display Properties tab for the Laptop Selection form.
d. Check Enable automatic retrieval of service item instance data, as shown below. This option is disabled by default. This option enables the ability to automatically retrieve and pre fill data about an existing service item instance. For this example, leave the Grid Options to their default selections and values. In particular, you want the user to have Edit access control to be able to add grid rows.
e. Below the Laptops dictionary in the left pane, click the Name field to see its HTML Representation window. In the Input Type field, choose “select (single)” from the drop-down menu. An Input Type of “Select Single” renders the Name field as a drop-down menu from which the user can choose only a single value. Also, change the Columns value to 32 to make the Name column width smaller.
Step 5 Create New Data Retrieval Rule. Click the Active Form Rules tab for the Laptop Selection form.
a. Choose New Rule > New Data Retrieval Rule
b. In the wizard, do the following:
– Set the Rule Type set to Distributing Rule and leave the Query Type set to Database Table Lookup.
– Check Form Load as the triggering event, as shown below.
– Choose Service Items from the Datasource drop-down menu, and Laptops from the Table Name drop-down menu.
– To create a Lookup Condition where data instances of “HP” in the Brand_Name field are excluded from selection, choose Brand_Name from the Table Column Name drop-down menu and “is not equal to” in the Operator drop-down menu, and enter HP in the Literal Value field (enabling its radio button), as shown below. Click OK.
– Map the Name column of the Laptops service item to the Name field of the Laptops dictionary, choose them from the three drop-down menus and then click OK.
Note The “*” next to Laptops indicates that Laptops is a grid dictionary.
Step 6 Create New Service Group and New Service. Use the Services component of the Service Designer module.
a. Choose New> New Service Group and enter the group name, choose the service team and enter the description.
b. Click Add This Service Group. The new group appears in the Services tree to the left.
c. Choose New > New Service. In the Name field of the resultant New Service window, enter Laptop Upgrade for this example. Enter “Upgrade one or more laptops.” for the description. Choose the service group you just created, Dave Service Group, from the Service Group drop-down menu.
d. Click Add This Service. The General Tab of the Laptop Upgrade service appears.
Step 7 Add Form to Service and View Service in My Services.
a. Click the Form tab of the Laptop Upgrade service that appeared after adding service in step 6 d.
b. Click Add Forms in the bottom left of the window. The Add Form popup window appears.
c. In the Search field, enter Laptop Selection to search for the Laptop Selection form you previously created.
d. Check the Laptop Selection form and then click Add.
e. The Laptop Selection form is added to the Laptop Upgrade service.
f. Choose the My Services module of Service Catalog.
g. Enter Laptop Upgrade in the “Search for Services containing:” field and then click Search. The Laptop Upgrade service appears.
h. Click Order to see the grid you created.
The grid appears with the header of “Laptops” taken from the Default Name of the dictionary. The column header names are taken from the HTML Representation Label field of the dictionary fields.
The Name field appears as a drop-down menu from which you can only choose a single value because you chose “select (single)” as the Input Type for the Name field. Click in the first row of the Name column and choose a name from the drop-down menu—the rest of the fields are automatically filled in. This happens because you checked “Enable automatic retrieval of service item instance data” for the form dictionary and mapped the Name column of the Laptops service item to the Name field of the Laptops dictionary.