Multiselect Lookup Control

Overview

Consider the situation where a subgrid of contacts needs to be placed on the Appointments activity form. This would be an N:N relationship between the Appointment and Contact entities. Referring to Figure 1, it’s not possible to create such a relationship.

Figure 1

To meet this requirement, one option is to use a Multiselect lookup control. (I found it in the Field Service managed solution.) Referring to Figure 2, the Contact(s) field is a multiselect lookup control. It works just like a normal lookup and allows multiple contacts to be selected.

Figure 2

The control is defined as a text field (which we’ll go through below) and it stores records as JSON. See below

[{"id":"90664585-c154-ed11-9562-002248183202","entityType":"contact","name":"John Smith"},
 {"id":"03c551ad-c254-ed11-9562-002248183202","entityType":"contact","name":"Jane Doe"}]

or

[{"_etn":"contact","_id":"90664585-c154-ed11-9562-002248183202","_name":"John Smith"},
 {"_etn":"contact","_id":"03c551ad-c254-ed11-9562-002248183202","_name":"Jane Doe"}]

Setup

1.) Create a text field and set it to the maximum character count of 4000.

Figure 3

2.) Add the component ‘Multiselect Lookup Control’

Figure 4

3.) Determine the id of the ‘All Active Contact’ view to be used

Figure 5

4.) Set the control to lookup the contact entity and ‘All Active Contact’ view

Figure 6