Scenario: Add custom drop-down and values to a custom property/field

This scenario shows how you can add a custom property to all the asset types and add drop-down values to it.

  1. Right-click the items folder at the following path and select Overlay Node:

    /libs/fd/cm/ma/gui/content/cmmetadataproperties/commonproperties/col1/items

  2. Under the newly created overlay node (https://experienceleague.adobe.com/apps/fd/cm/ma/gui/content/cmmetadataproperties/commonproperties/col1/items?lang=en)
    Create a node for each of the properties (fields) for which you need to create a drop-down (here geographicallocation) of the type nt:unstructured.

  3. Add the following properties to the node (here geographicallocation) and click Save All:

    NameTypeValue
    fieldLabelStringThe name you want to give the field/property. (Here: geographicallocation)
    nameString./extendedproperties/geographicallocation (Keep the value same as the field name you created under the items node)
    renderReadOnlyBooleantrue
    sling:resourceTypeStringgranite/ui/components/coral/foundation/form/select
  4. Under property node (here geographicallocation), add a new node with name items. Under the items node, add a node each for the values in the drop-down. As a good practice, add the first node as blank to serve as the default value of the drop-down and an option for the user to specify no value for the field. To add multiple options/drop-down values, repeat the following steps:

    1. Right-click the property node (here geographicallocation) and select Create > Create Node.

    2. Enter name of the field as item1, retain type as nt:unstructured, and click OK.

    3. Add the following properties to the newly created node (here item1) and then click Save All:

      NameTypeValue
      textStringThis is the value of the drop-down option that is visible to the user. Keep it blank for the blank (default) value or enter the value, such as International or Within US.
      valueStringValue stored in CRXDE for the text. Enter any unique keyword.

      customizationdropdownvaluescrxde

    The custom drop-down appears as the following in asset properties:

    drop-down_customization

    Scenario: Common tab for all asset types

    This scenario shows how you can add a custom tab, Recipients, to all the asset types (text, list, condition, and layout fragments) and the letters. The Recipients tab is where you can plan to put all your custom properties relevant to the recipients.

    Custom tab added for all asset types

    Using the following procedure, you can add a tab with a field to all your assets:

    1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

    2. In the apps folder, create a folder named cmmetadataproperties with path/structure similar to the cmmetadataproperties folder (in content folder) using the following steps:

      1. Right-click the cmmetadataproperties folder at the following path and select Overlay Node:

        /libs/fd/cm/ma/gui/content/cmmetadataproperties

        Overlay node

      2. Ensure that the Overlay Node dialog has the following values:

        Path: /libs/fd/cm/ma/gui/content/cmmetadataproperties

        Location: /apps/

        Match Node Types: Selected

      3. Click OK. The folder structure is created in the apps folder.

        Overlay folder structure created in CRX

        Click Save All.

    3. Under the cmmetadataproperties folder, add a node for creating a custom tab for all the assets (Example: commontab) using the following steps:

      1. Right-click the cmmetadataproperties folder and select Create > Create Node.

        Create node

      2. Ensure that the Create Node dialog has the following values and click OK:

        Name: commontab (or the name you want to give to this property)

        Type: nt:unstructured

      3. Click the new node you have created (here commontab). CRX displays the node’s properties.

      4. Add the following properties to the node (here commontab):

        NameTypeValue
        jcr:titleStringThe name you want to give the column. (Here: Recipients)
        sling:resourceTypeStringgranite/ui/components/coral/foundation/container
        1. Click Save All.
      5. For the tab node created in the last step (here commontab), create a node called item using the following step:

        1. Right-click the relevant node (here commontab) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: items

          Type: nt:unstructured

        3. Click Save All:

      6. In the items node you created in the previous step (under commontab), add a node for creating a column (here Column1) in the custom tab (commontab) using the following steps (to add more columns, repeat this step):

        1. Right-click the items node and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: Column1 (Or the name you want to give to the node - this name does not appear in the User Interface.)

          Type: nt:unstructured

        3. Add the following property to the node (Here Column1) and then click Save All:

          NameTypeValue
          sling:resourceTypeStringgranite/ui/components/coral/foundation/container
      7. In the node you created in the previous step (here Column1), add a node called items using the following steps:

        1. Right-click the node (here Column1) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: items

          Type: nt:unstructured

        3. Click Save All.

      8. To create a field in the custom tab (here Recipients), add a node (here GeographicalLocation). This property corresponds to the column you created. Use the following steps to create the field (to create more fields/nodes, repeat these steps.):

        1. Right-click the items node and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: GeographicalLocation (or another name for the field property)

          Type: nt:unstructured

        3. Add the following properties to the field node (here GeographicalLocation) and click Save All.

          NameTypeValue
          fieldLabelStringLocation of recipients (or the name you want to give the field.)
          nameString./extendedproperties/GeographicalLocation
          renderReadOnlyBooleantrue
          sling:resourceTypeString/libs/granite/ui/components/coral/foundation/form/textfield
      9. To add this tab for Letters, create an overlay folder with path/structure similar to the following items folder at the following path:

        /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/letter/items/tabs/items

        To create overlay for a letters or a different asset use the following path by replacing [assettype] with text, condition, list, datadictionary, or fragment:

        /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/[assettype]/items/tabs/items

        1. Right-click the items folder at the following path and select Overlay Node:

          /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/letter/items/tabs/items

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/letter/items/tabs/items

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder is created. Click Save All.

      10. In the newly created items folder, add a node for the custom tab in the asset (here mytab - this name does not show up in the User Interface) using the following steps:

        1. Right-click the items folder and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: mytab (or the name you want to give to this property)

          Type: nt:unstructured

        3. Click the new node you have created (here mytab). CRX displays the node’s properties.

        4. Add the following two properties to the node (here customtab):

          NameTypeValue
          pathStringfd/cm/ma/gui/content/cmmetadataproperties/commontab
          sling:resourceTypeStringgranite/ui/components/coral/foundation/include
        5. Click Save All.

      11. To view your customization, hover over the relevant asset (here a letter), click View Properties, and click Edit. The new tab (Recipients) and field (Location of Recipients) appear in the user interface.

        NOTE
        You may need to clear the browser cache before your customization appears in the UI.

        Custom tab added to letters

      Scenario: Adding custom properties for specific asset types

      This scenario shows how you can add a property to a particular asset type, such as a field to all the text assets. Using this process, you can add properties to one of the following:

      • Text
      • Condition
      • List
      • Layout Fragment
      • Data Dictionary
      • Letter

      For example, only to the text assets, you want to add a property, Location of recipients, to identify which geographical area that an asset is relevant to. Custom property added to an asset

      To add a property to an asset type, complete the following steps:

      1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

      2. To create a tab in an asset type (such as Text), create the following folder structure in the apps folder:

        /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/[AssetType]/items/tabs/items

        [AssetType] = text, condition, list, letter, datadictionary, or fragment

        Following are the steps to create this folder structure:

        1. Right-click the items folder at the following path and select Overlay Node:

          /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/[AssetType]/items/tabs/items

          For example, if you want to create a property for text assets, select the following folder:

          /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/text/items/tabs/items

          Overlay node

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/fd/cm/ma/gui/content/cmmetadataproperties/properties/[AssetType]/items/tabs/items

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder structure is created in the apps folder.

          Click Save All.

      3. In the newly created items folder, add a node for the custom tab in the asset (Example: customtab) using the following steps:

        1. Right-click the items folder and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: customtab (or the name you want to give to this property)

          Type: nt:unstructured

        3. Click the new node you have created (here customtab). CRX displays the node’s properties.

        4. Add the following two properties to the node (here customtab):

          NameTypeValue
          sling:resourceTypeStringgranite/ui/components/coral/foundation/container
          jcr:titleStringThe name of the field on the User Interface (here My tab)
        5. Click Save All.

      4. In the node you created in the previous step (here customtab), add a node called items using the following steps:

        1. Right-click the node (here customtab) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: items

          Type: nt:unstructured

        3. Click Save All.

      5. In the items node you created in the previous step (under customtab), add a node for creating a column (here Column1) in the custom tab using the following steps (to add more columns, repeat this step):

        1. Right-click the items node and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: Column1 (or the name you want to give to the node)

          Type: nt:unstructured

        3. Add the following property to the node (Here Column1) and then click Save All.

          NameTypeValue
          sling:resourceTypeStringgranite/ui/components/coral/foundation/container
      6. For each column you create (as specified in the previous step - here Column1), create a node called item using the following steps:

        1. Right-click the relevant column node (here Column1) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: items

          Type: nt:unstructured

        3. Click Save All:

      7. For each of the columns created, create a node under the items node for creating a field in the new tab in the User Interface. Repeat this step to create more fields in the column:

        1. Right-click the relevant node (here items under Column1) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: A name of your choice (here GeoLocation)

          Type: nt:unstructured

        3. Add the following properties to the node and then click Save All.

          NameTypeValue
          fieldLabelStringLocation of recipients (or the name you want to give the field.)
          nameString./extendedproperties/GeoLocation
          renderReadOnlyBooleantrue
          sling:resourceTypeStringgranite/ui/components/coral/foundation/form/textfield
      8. To view your customization, hover over the relevant asset (here a text), click View Properties, and click Edit. The new tab and field (Location of Recipients) appear in the user interface.

        NOTE
        You may need to clear the browser cache before your customization appears in the UI.

        Custom property added to a specific asset

      Display custom properties on the Asset Creation Page

      By default, the custom properties added to new tabs are visible only on the properties page and not on the asset creation page, as the asset creation page does not have tab layout. To display the custom properties on the asset creation page along with other properties, you need to do the following:

      1. Right-click the items folder at the following path and select Overlay Node:

        /libs/fd/cm/ma/gui/content/createasset/createletter/jcr:content/body/items/form/items/letterWizard/items/properties/items/properties/items/letterproperties/items

      2. Ensure that the Overlay Node dialog has the following values, for letter. For other asset types, path is given in the following table:

        Path: /libs/fd/cm/ma/gui/content/createasset/createletter/jcr:content/body/items/form/items/letterWizard/items/properties/items/properties/items/letterproperties/items

        Location: /apps/

        Match Node Types: Selected

        Depending on the type of asset, following needs to be the path:

        Asset/document typePath to be added
        Text/libs/fd/cm/ma/gui/content/createasset/createtext/jcr:content/body/items/form/items/textwizard/items/editproperties/items/properties/items/tabs/items/tab1/items
        List/libs/fd/cm/ma/gui/content/createasset/createlist/jcr:content/body/items/form/items/listwizard/items/editproperties/items/properties/items/tabs/items/tab1/items
        Condition/libs/fd/cm/ma/gui/content/createasset/createcondition/jcr:content/body/items/form/items/conditionwizard/items/editproperties/items/properties/items/tabs/items/tab1/items
        Fragment/libs/fd/cm/ma/gui/content/createasset/createfragment/jcr:content/body/items/form/items/fragmentwizard/items/properties/items/properties/items/tabs2/items/tab1/items
        Letter/libs/fd/cm/ma/gui/content/createasset/createletter/jcr:content/body/items/form/items/letterWizard/items/properties/items/properties/items/letterproperties/items
      3. Click OK. The folder structure is created in the apps folder.

      4. Under the overlay items node you created, create a node of the name col4 (or any other name) and click Save All.

        For example, following is the overlay node created for letters.

        /apps/fd/cm/ma/gui/content/createasset/createletter/jcr:content/body/items/form/items/letterWizard/items/properties/items/properties/items/letterproperties/items

      5. Add the following properties to the newly created node (here col4) and click Save All:

      NameTypeValue
      pathString

      This path is the pointer to the column created in:

      • For common tab for all asset types: /apps/fd/cm/ma/gui/content/cmmetadataproperties/commontab/items/col1
      • For different properties for different asset types: /apps/fd/cm/ma/gui/content/cmmetadataproperties/properties//items/tabs/items/customtab/items/col1
      sling:resourceTypeStringgranite/ui/components/coral/foundation/include

      customfieldappearinginmainproperties

      Custom property, Language, appearing in the UI for creating a letter

      Customize the list view to show custom properties

      After you have added a custom property to Correspondence Management assets, you need to make further changes in CRX/DE to ensure that the custom property is displayed in the Correspondence Management UI.

      Complete the following steps to display the custom property in the Correspondence Management’s asset list UI:

      1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

      2. Create the following folder structure in the apps folder:

        /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/lists/columns

        Following are the steps to create this folder structure:

        1. Right-click the columns folder at the following path and select Overlay Node:

          /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/lists/columns

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/lists/columns

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder structure is created in the apps folder.

          Click Save All.

      3. For each of the properties created, create a node under the columns node for creating a column in the User Interface. Repeat this step to create more columns in the UI:

        1. Right-click the relevant node (columns) and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: A name of your choice (here GeographicalLocation)

          Type: nt:unstructured

        3. Add the following properties to the node and then click Save All.

          NameTypeValue
          jcr:primaryTypeNament:unstructured
          jcr:titleString

          GeographicalLocation

          This value appears as the column header in the UI.

          sortableBoolean

          true

          A value of true signifies that the user can sort the values in this column.

      4. Create the following folder structure in the apps folder:

        /libs/fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage

        Following are the steps to create this folder structure:

        1. Right-click the columns folder at the following path and select Overlay Node:

          /libs/fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder structure is created in the apps folder.

          Click Save All.

      5. Copy the childlistpage.jsp file from the following location:

        /libs/fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage/childlistpage.jsp

        Paste the file in the following location:

        /apps//fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage/.

      6. Open the childlistpage.jsp file (https://experienceleague.adobe.com/apps/fd/cm/ma/gui/components/admin/childpagerenderer/childlistpage/childlistpage.jsp?lang=en) and make the following changes:

        1. Add the following to line 19 of the file (following the copyright statement).

          <%@page import="java.util.Map"%>
          
        2. Add the following code of a function that gets value for each custom property to the end of the file:

          <%!
              private String getCustomPropertyValue(Map<String, Object> extendedProperties, String propertyName) {
          
                  String propertyValue = "";
                  if (extendedProperties.containsKey(propertyName)) {
                      propertyValue = (String) extendedProperties.get(propertyName);
                  }
          
                  return propertyValue;
              }
          %>
          
        3. Add the following before the starting of the <tr> tag (<tr <%= attrs.build() %>>):

          <%
              String GeoLocation = "";
              if (asset != null) {
                      Map<String, Object> extendedProperties = asset.getExtendedProperties();
                      if (extendedProperties != null) {
                          GeoLocation = getCustomPropertyValue(extendedProperties,"GeoLocation");
                      }
              }
          %>
          

          In the code, GeoLocation is the value that you set in the name property while creating the custom node/field. While creating a custom node/field, you specified the name of property with ./extendedproperties/ prefix: ./extendedproperties/GeoLocation. In the code, the prefix is not required.

        4. For displaying the new property in the UI, add a TD tag as following before the closing tr (</tr>) tag:

          <td is="coral-td" value="<%= xssAPI.encodeForHTMLAttr(geographicalLocation) %>"><%= xssAPI.encodeForHTML(geographicalLocation) %></td>
          

          To add more columns, repeat steps 6.3 and 6.4.

        5. Click Save All.

      7. To view your customization, open list view of document fragments, or letters in which you have added the custom property.

        The UI column and property added in this procedure is displayed for all asset types. However, the values in these properties can be entered and displayed only for the asset types for which you originally added the custom property.

        For example, using the Scenario: Adding custom properties for specific asset types you add a custom property to text assets, you can enter custom properties to text assets only. If, however, you display that custom property in the UI, the column appears for all asset types.

        custompropertyinlistview

      8. (Optional) By default the new column appears as the last column in the UI. To make the column appear at a specific position, add the following property to the column node:

      NameTypeValue
      sling:orderBeforeString

      The name of the column node at path "/libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/list/columns" before which custom column needs to appear on UI.

      Here, if you want Geographical Location column to appear before (to the left of) the Version column, add the property sling:orderBefore to GeoLocation node at path ""/apps/fd/cm/ma/gui/content/cmassets/jcr:content/views/list/columns/GeoLocation" and set the value of property to version.

      When you add the sling:orderBefore property to specify the column location, then you also need to update the order of the corresponding <td> tag specified in step 6.4 of this procedure. For example, in this case, you need to ensure that the <td> tag of Geographical Location is placed before <td> tag of Version column:

      <td is="coral-td" value="<%= xssAPI.encodeForHTMLAttr(geographicalLocation) %>"><%= xssAPI.encodeForHTML(geographicalLocation) %></td>
      <td is="coral-td" value="<%= xssAPI.encodeForHTMLAttr(version) %>"><%= xssAPI.encodeForHTML(version) %></td>
      

      Enable search for custom properties

      By default, full text search does not include custom properties that you add to the UI using CRX/DE.

      To include the custom properties in search, you need to allow indexing of custom properties.

      To allow indexing of custom properties, complete the following steps:

      1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

      2. Go to /oak:index/cmLuceneand add a node named aggregates under it.

        1. Right-click the cmLucene folder and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: aggregates

          Type: nt:unstructured

        3. Click Save All.

      3. Under the newly created aggregates folder, add a node cm:resource. And under cm:resource, add a node named include0.

        1. Right-click the aggregates folder and select Create > Create Node. Ensure that the Create Node dialog has the following values and click OK:

          Name: cm:resource

          Type: nt:unstructured

        2. Right-click the cm:resource folder and select Create > Create Node. Ensure that the Create Node dialog has the following values and click OK:

          Name: include0

          Type: nt:unstructured

        3. Click the new node you have created (here include0). CRX displays the node’s properties.

        4. Add the following property to the node (here include0):

          NameTypeValue
          pathStringextendedProperties
        5. Click Save All.

      4. Go to properties at the following location and add a node location under it: /oak:index/cmLucene/indexRules/cm:resource/properties

        Repeat this step for each of the custom properties you want to add to the search.

        1. Right-click the properties folder and select Create > Create Node.

        2. Ensure that the Create Node dialog has the following values and click OK:

          Name: location (or the name of the custom property you want to add to search)

          Type: nt:unstructured

        3. Click the new node you have created (here location). CRX displays the node’s properties.

        4. Add the following properties to the node (here location):

          NameTypeValue
          analyzedStringtrue
          nameStringextendedProperties/location (or the name of the property you want to add to search)
          propertyIndexBooleantrue
          useInSuggestBooleantrue
        5. Click Save All.

      5. Now you can use custom property values in full text search to locate relevant assets.

      NOTE
      If you are still unable to search, it may be because of an indexing issue. For re-indexing, go to the following node and change value of property “re-index” to true:
      /oak:index/cmLucene" and change value of property

      Change default view of the search page

      1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

      2. In the apps folder, create a folder named list with path/structure similar to the list folder in /libs/granite/ui/content/shell/omnisearch/searchresults/singleresults/views:

        1. Right-click the items folder at the following path and select Overlay Node:

          /libs/granite/ui/content/shell/omnisearch/searchresults/singleresults/views/list

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/granite/ui/content/shell/omnisearch/searchresults/singleresults/views/list

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder structure is created in the apps folder.

        4. Click Save All.

      3. In the newly created node, list, add the following property and click Save All:

        NameTypeValue
        sling:orderBeforeStringcard
      4. The customization shows search results in List view for all consoles, including Forms and Documents, Assets, and Sites.

      Change default view of the assets page

      NOTE
      These steps change the default view of all consoles such as Forms and Documents, Assets, and Sites.
      1. Go to https://'[server]:[port]'/[ContextPath]/crx/de and login as Administrator.

      2. In the apps folder, create a folder named list with path/structure similar to the list folder in:

        /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/

        1. Right-click the items folder at the following path and select Overlay Node:

          /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/list

        2. Ensure that the Overlay Node dialog has the following values:

          Path: /libs/fd/cm/ma/gui/content/cmassets/jcr:content/views/list

          Location: /apps/

          Match Node Types: Selected

        3. Click OK. The folder structure is created in the apps folder.

        4. Click Save All.

      3. In the newly created node, list, add the following property and click Save All:

        NameTypeValue
        sling:orderBeforeStringcard
      4. Clear the browser cookies or use the incognito mode of your browser to view the assets. The assets page, by default, appears in the card layout.

      Show/hide custom properties on Asset Creation and Properties pages

      To show or hide the custom properties, complete the following steps:

      1. Under the custom property node, such as geographicallocation, create a node with name “granite:rendercondition” of type “nt:unstructured.”

      2. Add the following property to the node and click Save All:

        NameTypeValue
        sling:resourceTypeStringfd/cm/ma/gui/components/admin/assetsproperties/custompropertyconfig
      3. To hide this property on the asset creation page, add the following property to it and click Save All:

        NameTypeValue
        hideOnCreateBooleantrue
      4. To hide the custom property on the properties page of the assets, add the following property to it and click Save All:

        NameTypeValue
        hideOnEditBooleantrue

        To display the values again, either reset the property values to false or delete the property entries.

Experience Manager


Espressos & Experience Manager: AEM Forms

Espressos & Experience Manager

Thursday, Mar 6, 7:00 PM UTC

Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more