Get started > Use case scenarios - customizing with business rules > Using rules to filter drop-down selection

Using rules to filter a drop-down selection

The following use case scenario demonstrates how you can customize the form for incidents to display all three support groups in a single drop-down.

The aim was to help users select an assignment group for an incident, based on the three support groups of the associated service.

1st, 2nd, and 3rd level support

The first idea was to create three separate rules, one for each group. However, this presented each group with its own header, and took up too much screen real estate.

A better approach was to create a single rule that displayed all three fields under a single header. This was achieved by using the union function to combine three different fields from the service record into a single filter.

The implementation (shown below) saves screen real estate, and puts key information in front of the user in a way that may be more suitable.

Although the use case is specific, the techniques involved can easily be adapted.

Create the rule

  1. From the main menu, select Administration > Configuration > Studio > Processes and Rules.

  2. Select the Incident record type.

  3. In the tree on the left, select Incident (the top level of the tree).
  4. In Rendering forms, click Add, then select "If...Then" rule.

  5. In the Field selection rules, select Define suggested values based on filter.

  6. Click OK.

    "If...Then" rule

Edit the rule

  1. Click expression, and paste the following:

    ${entity.RegisteredForActualService != null}

  2. Click OK.

    This ensures the rule does not operate when there is no service selected for the incident.

    Setting the expression parameter

  3. Click field, and select Assignment group. Then click OK.

  4. Click title, and type SERVICE SUPPORT GROUPS. Then click OK.

  5. Click all records, then Add Item.

    1. In the first drop-down, select Id.

    2. Leave the second drop-down as IN.

    3. In the last box, paste the following expression:

      ${union(entity.RegisteredForActualService.SupportLevel1Group.Id,entity.RegisteredForActualService.SupportLevel2Group.Id,entity.RegisteredForActualService.SupportLevel3Group.Id)}

      This tells the filter to find any Group where the Id is the union of the three group fields from the service, creating an "or" type filter.

  6. Click Save.

    "If...Then" rule

Implementation

Using the preceding rule, when an agent adds a service to an incident, and then selects the Assignment group drop-down, the three support groups from the service record are displayed:

Final drop-down

Note

Using this rule, the drop-down displays these three groups only.

To see every group in the drop-down, you need to create an additional rule, similar to the above, with the following changes in the Using rules to filter a drop-down selection section:

  • In paragraph 4, type instead: ALL GROUPS

  • Omit paragraphs 5-8 inclusive

Variation

A related use case scenario involves creating multiple lists of values, and then populating a field using only results that are in both lists. This is achieved using the union and intersect functions.

In the following example, in creating a request, the suggested value for Service desk group only shows a group if the organizational group of the Requested for person is one of the 1st, 2nd or 3rd level support groups assigned to the service.

Create the rule

  1. From the main menu, select Administration > Configuration > Studio > Processes and Rules.

  2. Select the Request record type.

  3. In the tree on the left, select Request (the top level of the tree).
  4. In Rendering forms, click Add, then select Simple rule.

  5. In the Field selection rules, select Define suggested values based on filter.

  6. Click OK.

    Screenshot of simple rule

Edit the rule

  1. Click field, and select Service desk group. Then click OK.

  2. Click title, and type SERVICE DESK GROUP. Then click OK.

  3. Click all records, then Add Item.

  4. In the first drop-down, select Id.

  5. Leave the second drop-down as IN.

  6. In the last box, paste the following expression:

    ${intersection(union(entity.RegisteredForActualService.SupportLevel1Group.Id,entity.RegisteredForActualService.SupportLevel2Group.Id,entity.RegisteredForActualService.SupportLevel3Group.Id),union(entity.RequestedByPerson.OrganizationalGroup.Id))}
  7. Click Save.

Implementation

Assume an actual service has the following:

  • 1st level support - Accounting

  • 2nd level support - Service Desk Analysts

  • 3rd level support - Escalation Team

Further assume a request related to that actual service is for a person who belongs to the Accounting organization. When the agent creates the request, and then selects the Service desk group drop-down, only the one group that is common to the service and the organization is displayed: Accounting.