Configuring Autocomplete and MultiSelect Autocomplete Fields: Business Mappings

An autocomplete field has three configurable options:

  1. where and how to search: we must be able to define the module/table where we will look for values and if we want to use startswith or contains. This must include the possibility to use Sql inside cbMap that can overwrite the query to search on specific situations.Ex: search and show all the fields of one module,or show the options of one picklist. Also, it is normal to be able to configure the number of characters that launch the search
  2. what information we should return: there will be one main entity identifier and possibly some additional fields to support the decision of what record to select
  3. what fields to fill in and with what information. automatically copy related fields of the source module into the destinations fields of the current module (ex: address fields of Accounts into address fields of Contacts)

Using the Extended Field Information mapping we can define all of these options.

This next map will activate the functionality on the Potentials Name and RelatedTo field:

Potentials_FieldInfo

<map>
    <originmodule>
        <originname>Potentials</originname>
    </originmodule>
    <fields>
        <field>
            <fieldname>related_to</fieldname>
            <features>
                <feature>
                    <name>searchmodule</name>
                    <value>Contacts</value>
                </feature>
                <feature>
                    <name>searchfields</name>
                    <values>
                        <value>
                            <module>Accounts</module>
                            <value>accountname</value>
                        </value>
                        <value>
                            <module>Contacts</module>
                            <value>firstname,lastname</value>
                        </value>
                    </values>
                </feature>
                <feature>
                    <name>searchcondition</name>
                    <value>startswith</value>
                </feature>
                <feature>
                    <name>entityfield</name>
                    <values>
                        <value>
                            <module>Accounts</module>
                            <value>accountname</value>
                        </value>
                        <value>
                            <module>Contacts</module>
                            <value>firstname</value>
                        </value>
                    </values>
                </feature>
                <feature>
                    <name>showfields</name>
                    <values>
                        <value>
                            <module>Accounts</module>
                            <value>accountname,phone,email1</value>
                        </value>
                        <value>
                            <module>Contacts</module>
                            <value>firstname,email,mailingstreet</value>
                        </value>
                    </values>
                </feature>
                <feature>
                    <name>fillfields</name>
                    <values>
                        <value>
                            <module>Accounts</module>
                            <value>forecast_amount=annual_revenue</value>
                        </value>
                        <value>
                            <module>Contacts</module>
                            <value>leadsource=leadsource,assigned_user_id=assigned_user_id,closingdate=support_end_date</value>
                        </value>
                    </values>
                </feature>
            </features>
        </field>
        <field>
            <fieldname>potentialname</fieldname>
            <features>
                <feature>
                    <name>searchmodule</name>
                    <value>Contacts</value>
                </feature>
                <feature>
                    <name>searchfields</name>
                    <value>firstname,lastname</value>
                </feature>
                <feature>
                    <name>searchcondition</name>
                    <value>startswith</value>
                </feature>
                <feature>
                    <name>entityfield</name>
                    <value>firstname</value>
                </feature>
                <feature>
                    <name>showfields</name>
                    <value>firstname,email,mailingstreet</value>
                </feature>
                <feature>
                    <name>fillfields</name>
                    <value>leadsource=leadsource,assigned_user_id=assigned_user_id,closingdate=support_end_date</value>
                </feature>
            </features>
        </field>
    </fields>
</map>

There are only two types of fields that support autocomplete: relation or capture fields (uitype 10) and uitype 2 text fields. The only way to create uitype 2 text fields is by programming.

Each of the two types have a different extended information structure as can be seen in the example above. The potentialname field has a flat value directive as it only can be searching on one module while the related_to field has a richer syntax due to the possibility of having to search on more than one related module.

Please apply the correct XML structure (as explained above) for your type of field or this functionality will not work correctly.

MultiSelect Autocomplete Fields

MultiSelect Autocomplete Fields work exactly the same. The uitype is 1025 and the extended field information is exactly the same as a normal select autocomplete field.

This is what my test field definition for a uitype 1025 in the potentials module looks like:

<field>
  <fieldname>ui1025</fieldname>
  <features>
<feature>
  <name>searchmodule</name>
  <value>Contacts</value>
</feature>
<feature>
  <name>searchfields</name>
  <values>
<value>
  <module>Accounts</module>
  <value>accountname</value>
</value>
<value>
  <module>Contacts</module>
  <value>firstname,lastname</value>
</value>
  </values>
</feature>
<feature>
  <name>searchcondition</name>
  <value>startswith</value>
</feature>
<feature>
  <name>entityfield</name>
  <values>
<value>
  <module>Accounts</module>
  <value>accountname</value>
</value>
<value>
  <module>Contacts</module>
  <value>firstname</value>
</value>
  </values>
</feature>
<feature>
  <name>showfields</name>
  <values>
<value>
  <module>Accounts</module>
  <value>accountname,phone,email1</value>
</value>
<value>
  <module>Contacts</module>
  <value>firstname,email,mailingstreet</value>
</value>
  </values>
</feature>
<feature>
  <name>fillfields</name>
  <values>
<value>
  <module>Accounts</module>
  <value>forecast_amount=annual_revenue</value>
</value>
<value>
  <module>Contacts</module>
  <value>leadsource=leadsource,assigned_user_id=assigned_user_id,closingdate=support_end_date</value>
</value>
  </values>
</feature>
<feature>
  <name>multiselect</name>
  <value>true</value>
</feature>
  </features>
</field>

coreBOS Documentación