How To Setup a Dependent Lookup Field
Lookup fields allow you to specify a link to another case within your current case. An example of this could be setting a customer field on an order, or an address for shipping and billing etc. Sometimes, if you want to search for cases to set, you only want a subset of the full list, for example if you were linking from an order to a customer, the search might only return active customers, or if the order is from a source, only customers who apply to that source. We do this by using dependent lookups. Continuing with the customer and order with specific source example, we might have the following schema snippet
- name: customer type: relation display_name: Customer relation: customer uif: customer_reference display: single_line join_character: " " display_fields: - title lookup_defaults: - lookup_field_name: source_reference type: reference value: customer.source_reference - lookup_field_name: current_status type: string value: "Active"
The above snippet defines a customer field that relates to a customer case type. In this instance, we have also defined lookup_defaults, which gives Caseblocks some values to ‘filter’ the results on. We have specified 2 filters here, one being a reference type and the other string.
If the lookup is dependent on another field in the case, eg source, then we specify reference and the value is the location in the document that contains the value to search on.
If the lookup is based on a static value, say “Active” or “Inactive” then specify that as string type and the value contains the string to apply on the search