Understanding the use of conditions in MetadataConfig.xml
Introduction
The dialogs and list views are dynamically created starting from the MetadataConfig XML. First the correct dialog or list view is located using the ID attribute. Then all referenced objects are included and finally the remaining XML is conditional published.
Conditions are especially useful for dialogs (like property windows). For each combination of object type and ChangeMode a new dialog is defined (e.g. ishfrm[@id="Properties_Create_ISHMasterDoc"]). In order to avoid duplicate declaration you should reference each field that is used in multiple dialogs. Of course, sometimes there is still a minor difference between 2 definitions of the same field. This can be solved by adding conditions.
How should conditions be used?
- Try to place you conditions on the smallest, possible element!
- Avoid to use conditions on a tab sheet (ishfrmtab) , a group (ishfrmgroup) or a field (ishfrmfield) unless the complete object must be removed or added in certain circumstances
Which conditions are currently used?
| Conditions | Allowed values | Description |
|---|---|---|
| ChangeMode | Create and Update Deprecated: NewVersion | This condition can be used to initialize a value when creating the object and to prevent the user to modify a value on an existing object |
| CreateReason | CheckInAs, Duplicate, Import, New and NewVersion | Specifies the reason that an object was created |
| ISHType | Object Types | Use this condition when the layout, behavior or initial value of a field depends on the object type |
| MetadataConfigId | The ID of any dialog (ishfrm) or list view (ishlist) in the MetadataConfig XML | This condition is no longer used and can be replaced by a combination of "ChangeMode" and "ISHType" |
| ISHUserCapability | Any user capability (e.g. Administrator, Author, Reviewer, ...) | Use this condition to limit certain actions (e.g. overwriting a value) to an "Administrator". |
| IsReleased | Value indicating whether the object is released. true if the object is released; otherwise, false. | |
| OutputFormat | Any output format. | Use this condition to define output format specific properties (Properties that are only available for a specific output format). |
Example 1:
This example demonstrates how to prevent the user to modify the required resolution on an existing publication.
<ishfrmfield name="PublicationResolutionField" ishfieldref="FISHREQUIREDRESOLUTIONS" level="version">
<label resourceref="PublicationResolutionField.Label">Resolution</label>
<description resourceref="PublicationResolutionField.Description">The resolution used for assembling the publication. </description>
<typepulldown ishcondition="ChangeMode = 'Create'">
<valuelist>
<lovlist ishlovref="DRESOLUTION"/>
</valuelist>
</typepulldown>
<typelabel ishcondition="ChangeMode = 'Update'"/>
</ishfrmfield>
Example 2:
The next example initializes different values depending on the object type.
<ishfrmfield name="TranslationManagementEnabledField" ishfieldref="FNOTRANSLATIONMGMT" level="logical" ishcondition="ISHType in ('ISHMasterDoc', 'ISHIllustration', 'ISHLibrary','ISHModule','ISHTemplate')">
<label resourceref="TranslationManagementEnabledField.Label">Enable translation management</label>
<description resourceref="TranslationManagementEnabledField.Description"/>
<typecheckbox>
<checkedvalue>No</checkedvalue>
<uncheckedvalue>Yes</uncheckedvalue>
</typecheckbox>
<value overwrite="yes" ishcondition="ChangeMode='Create' and ISHType in ('ISHMasterDoc', 'ISHLibrary', 'ISHModule')">No</value>
<value overwrite="yes" ishcondition="ChangeMode='Create' and ISHType in ('ISHIllustration', 'ISHTemplate')">Yes</value>
</ishfrmfield>
Example 3:
Following example shows how to specify on which object types the field FINHERITEDLANGUAGES should be visual.
<ishfrmfield name="InheritedLanguagesField" ishfieldref="FINHERITEDLANGUAGES" level="logical" ishfielddatatype="typelanguage" ishcondition="ISHType in ('ISHIllustration', 'ISHLibrary', 'ISHModule')">
<label resourceref="InheritedLanguagesField.Label">Inherited languages</label>
<description resourceref="InheritedLanguagesField.Description">Target Languages that are inherited from a map. </description>
<typelabel/>
<multivalue/>
<value overwrite="yes" ishcondition="ChangeMode in ('Create')"/>
</ishfrmfield>