Skip to content

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.

Configuration

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

Info

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 and limetype part of a lime query. Everything else (like the ordering, response format, limit etc.) is not customizable for now.

Info

In lime-crm<=2.84.0 you only need to configure the filter. In any version after that you also need to configure which limetype the filter should be applied on.

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.

Examples

1. Active coworkers

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

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

Info

remove the limetype key from the query if your solution is based on lime-crm<=2.84.0. Lime will automtically migrate your config to contain the limetype if you're upgrading from an older version.

2. Connecting active person to deal

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

{
  "property": "person",
  "globalSearch": true,
  "query": {
    "filter": {
      "op": "AND", 
      "exp": [
        {
          "key": "inactive",
          "op": "=",
          "exp": false

        },{
          "key": "company",
          "op": "=",
          "exp": "%activeObject%.company"
        }

        ]
    }
  }
},

Info

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.

3. Main helpdesktype

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

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

4. Sub helpdesktype

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

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