Developer Resource - Model Map Overrides
Customizing a model map doesn't mean you have to write rewrite the existing ones when you take advantage of overrides. You can write a model map file just describing the customizations you need for each model map. These XML override files live in source\Web\Models\custom\
.
An example overrides file is provided that demonstrates the capabilities of model map overrides.
It is located at source\Web\Models\custom\case.map.config
Model Map Override File Format
<model overrides="">
<!-- all inherited attributes are available, here are the additions -->
<query>
<removeProperty key="" />
<removeMappedProperty key="" />
<removeMappedCollection key="" />
<traverseRelation name="">
<removeProperty key="" />
<removeMappedProperty key="" />
<removeMappedCollection key="" />
</traverseRelation>
<addMappedProperty key="">
<removeProperty key="" />
</addMappedProperty>
</query>
</model>
Example Model Map Override File
<model overrides="case">
<query from="qry_case_view" type="view">
<removeProperty key="id" />
<traverseRelation type="adhoc" field="elm_objid" table="case" targetField="objid">
<addMappedProperty key="additionalFields">
<addProperty key="altSiteName" field="alt_site_name" dataType="string" />
</addMappedProperty>
</traverseRelation>
</query>
</model>
XML Reference
<model>
Attribute Name | Description |
---|---|
overrides | This value matches the model element's name attribute of which you wish to override |
<removeProperty><removeMappedProperty><removeMappedCollection>
Attribute Name | Description |
---|---|
key | This value matches the property, mapped property or mapped colection element you wish to remove from the inherited model map. |
To remove properties, mapped properties, or mapped collections from relations, you must add the same traverse relation elements (as noted in the example above).
If all properties are removed from a traversal, that traversal will also be removed.
Additional Fields Convention
As of Agent 18, the additional fields conventions is made available to minimize the need to customize the create/edit endpoints for entities. By moving custom fields into the additionalFields
mapped property (see above example), those fields are automatically persisted to the database during create/edit operations using the AdditionalFields
convention in Dovetail SDK.
Customization Example
A complete example has been provided in the Dovetail knowledgebase at: https://support.dovetailsoftware.com/selfservice/solutions/show/975
The example includes a model map override, along with UI customizations.
For this example, we will make use of the alt_site_name
field on the Case table. We'll store the site_id and simply join from alt_site_name to site_id to find the alternate site. While we’re at it, we’ll customize the UI to use a Site Picker to select the alternate Site. We’ll accomplish all of this without touching any backend C# code.