Option queries in the web client

Option queries are used to simplify the connection of different objects and makes it possible to decide what subset of a certain limetype the user should be able to choose from when connecting a certain limetype to another.

One example of a common option query is:

As a sales rep I can only connect the customer contact for a certain deal to the customer contacts that are connected to the customer that the deal is connected to.

Option queries are configured by administrators through the administration page in the web client and for the specific relation property in the card view.

Note!

As of now option queries can only be configured via json. Activate the code editor with the switch (“Show code editor”) in the top right corner.

Option queries in Lime CRM Web Client uses Lime Query to achieve the wanted behavior. As you'll see in the examples you currently can only configure the filter part of a lime query. Everything else (like the ordering, response format, limit etc.) is not customizable for now.

It is possible to configure whether or not it should be possible to search outside the option query with the globalSearch option. Setting “globalSearch”: false means that the user cannot search among or select an object that does not match the query. If the option is set to true the user will search among all objects for the specific limetype, when the query doesn't return any results.

There are two sources for configuration when it comes to the properties you see in the suggestions. If there is a search view for the limetype, the properties are based on that. If not, the view defaults to all properties that have descriptive labels.

Wanted behavior: It should only be possible to select active coworkers when connecting responsible salesperson to a deal.

How to configure: Navigate to the card view for the deal limetype and add the following configuration for the coworker property (the relation to the coworker limetype). Note here that property is referring to the property name on the deal limetype, while limetype is the coworker limetype's name.

        {
          "property": "coworker",
          "globalSearch": false,
          "query": {
            "limetype": "coworker",
            "filter": {
                  "key": "inactive",
                  "op": "=",
                  "exp": false
                }
          }
        },

Wanted behavior: It should be possible to get suggestions for active persons connected to the same company as the deal is connected to when connecting contact person for a certain deal. However, it should be possible to find other persons to connect the deal to.

How to configure: Navigate to the card view for the deal limetype and add the following configuration for the person property (the relation to the person limetype). Note here that property is referring to the property name on the deal limetype, while limetype is the person limetype's name.

        {
          "property": "person",
          "globalSearch": true,
          "query": {
            "limetype": "person",
            "filter": {
              "op": "AND", 
              "exp": [
                {
                  "key": "inactive",
                  "op": "=",
                  "exp": false
                  
                },{
                  "key": "company",
                  "op": "=",
                  "exp": "%activeObject%.company"
                }

                ]
            }
          }
        },

Note!

Please note the “globalSearch”: true, setting. This allows the user to search outside the filter for setting another person. The suggestions will only show the persons in the filter though.

Wanted behavior: It should only be possible to select an active, main helpdesktype when categorizing a helpdesk ticket.

How to configure: Navigate to the card view for the helpdesk limetype and add the following configuration for the helpdesktype property (the relation to the main helpdesktype limetype). Note here that property is referring to the property name on the helpdesk limetype, while limetype is the helpdesktype limetype's name.

        {
          "property": "helpdesktype",
          "globalSearch": false,
          "query": {
            "limetype": "helpdesktype",
            "filter": {
              "op": "AND",
              "exp": [
                {
                  "key": "inactive",
                  "op": "=",
                  "exp": false
                },
                {
                  "key": "mainhelpdesktype",
                  "op": "=",
                  "exp": null
                }
              ]
            }
          }
        },

Wanted behavior: Setting sub helpdesktype when working with tickets. It should only be possible to select a subhelpdesktype that is active and that is connected to the same helpdesktype as “main helpdesktype” on the active object.

How to configure: Navigate to the card view for the helpdesk limetype and add the following configuration for the sub helpdesktype property (the relation to the sub helpdesktype limetype). Note here that property is referring to the property name on the helpdesk limetype, while limetype is the helpdesktype limetype's name.

        {
          "property": "subhelpdesktype",
          "globalSearch": false,
          "query": {
            "limetype": "helpdesktype",
            "filter": {
              "op": "AND",
              "exp": [
                {
                  "key": "inactive",
                  "op": "=",
                  "exp": false
                },
                {
                  "key": "mainhelpdesktype",
                  "op": "=",
                  "exp": "%activeObject%.helpdesktype"
                }
              ]
            }
          }
        },

Wanted behavior: Select helpdesktype when working with tickets. It should only be possible to select a helpdesktype that is active and that is connected to the correct helpdeskcategory as the active object.

How to configure: Navigate to the card view for the helpdesk limetype (helpdeskcategory & mainhelpdesktype) and add the following configuration:

        {
          "property": "helpdeskcategory"
        },
        {
          "property": "mainhelpdesktype",
          "globalSearch": false,
          "query": {
            "limetype": "helpdesktype",
            "filter": {
              "op": "AND",
              "exp": [
                {
                  "key": "inactive",
                  "op": "=",
                  "exp": false
                },
                {
                  "key": "helpdeskcategory",
                  "op": "=",
                  "exp": "%activeObject%.helpdeskcategory"
                }
              ]
            }
          }
        },

Note!

Note here that property is referring to the property name on the helpdesk limetype, while limetype is the helpdesktype limetype's name.


  • Last modified: 3 years ago
  • by Tomas Eketorp